Birth Order Effects

Helper

source("0_helpers.R")
## 
## Attaching package: 'formr'
## The following object is masked from 'package:rmarkdown':
## 
##     word_document
## 
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
## 
##     date
## Warning in checkMatrixPackageVersion(): Package version inconsistency detected.
## TMB was built with Matrix version 1.2.17
## Current Matrix version is 1.2.15
## Please re-install 'TMB' from source using install.packages('TMB', type = 'source') or ask CRAN for a binary version of 'TMB' matching CRAN's 'Matrix' package
## 
## Attaching package: 'broom.mixed'
## The following object is masked from 'package:broom':
## 
##     tidyMCMC
## Loading required package: carData
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
## 
## Attaching package: 'data.table'
## The following objects are masked from 'package:lubridate':
## 
##     hour, isoweek, mday, minute, month, quarter, second, wday, week, yday, year
## The following objects are masked from 'package:formr':
## 
##     first, last
## Loading required package: Matrix
## 
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
## 
##     lmer
## The following object is masked from 'package:stats':
## 
##     step
## 
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
## This is lavaan 0.6-3
## lavaan is BETA software! Please report any bugs.
## 
## Attaching package: 'lavaan'
## The following object is masked from 'package:psych':
## 
##     cor2cov
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## 
## Attaching package: 'Hmisc'
## The following object is masked from 'package:psych':
## 
##     describe
## The following objects are masked from 'package:base':
## 
##     format.pval, units
## 
## Attaching package: 'tidyr'
## The following object is masked from 'package:Matrix':
## 
##     expand
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:Hmisc':
## 
##     src, summarize
## The following objects are masked from 'package:data.table':
## 
##     between, first, last
## The following objects are masked from 'package:lubridate':
## 
##     intersect, setdiff, union
## The following objects are masked from 'package:formr':
## 
##     first, last
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## 
## Attaching package: 'codebook'
## The following object is masked from 'package:psych':
## 
##     bfi
## The following objects are masked from 'package:formr':
## 
##     aggregate_and_document_scale, asis_knit_child, expired, paste.knit_asis
## 
## Attaching package: 'effsize'
## The following object is masked from 'package:psych':
## 
##     cohen.d

Load data

birthorder = readRDS("data/alldata_birthorder.rds")

Data preparations

# For analyses we want to clean the dataset and get rid of all uninteresting data
birthorder = birthorder %>%
  filter(!is.na(pidlink)) %>% # no individuals who are only known from the pregnancy file
  filter(is.na(lifebirths) | lifebirths == 2) %>% # remove 7 and 2 individuals who are known as stillbirth or miscarriage but still have PID
  select(-lifebirths) %>%
  filter(!is.na(mother_pidlink)) %>%
  select(-father_pidlink) %>%
  filter(is.na(any_multiple_birth) | any_multiple_birth != 1) %>% # remove families with twins/triplets/..
  filter(!is.na(birthorder_naive)) %>%
  select(-starts_with("age_"), -wave, -any_multiple_birth, -multiple_birth) %>%
  mutate(money_spent_smoking_log = if_else(is.na(money_spent_smoking_log) & ever_smoked == 0, 0, money_spent_smoking_log),
         amount = if_else(is.na(amount) & ever_smoked == 0, 0, amount),
         amount_still_smokers = if_else(is.na(amount_still_smokers) &  still_smoking == 0, 0, amount_still_smokers),
         birthyear = lubridate::year(birthdate))

# recode Factor Variable as Dummy Variable
birthorder = left_join(birthorder,
                                birthorder %>%
                                  filter(!is.na(Category)) %>%
                                  mutate(var = 1) %>%
                                  select(pidlink, Category, var) %>%
                                  spread(Category, var, fill = 0, sep = "_"), by = "pidlink") %>%
  select(-Category)

# recode Factor Variable as Dummy Variable
birthorder = left_join(birthorder,
                                birthorder %>%
                                  filter(!is.na(Sector)) %>%
                                  mutate(var = 1) %>%
                                  select(pidlink, Sector, var) %>%
                                  spread(Sector, var, fill = 0, sep = "_"), by = "pidlink") %>%
  select(-Sector)

### Variables
birthorder = birthorder %>%
  mutate(
    # center variables that are used for analysis
  g_factor_2015_old = scale(g_factor_2015_old),
  g_factor_2015_young = scale(g_factor_2015_young),
  g_factor_2007_old = scale(g_factor_2007_old),
  g_factor_2007_young = scale(g_factor_2007_young),
  raven_2015_old = scale(raven_2015_old),
  math_2015_old = scale(math_2015_old),
  count_backwards = scale(count_backwards),
  raven_2015_young = scale(raven_2015_young),
  math_2015_young = scale(math_2015_young),
  words_remembered_avg = scale(words_remembered_avg),
  words_immediate = scale(words_immediate),
  words_delayed = scale(words_delayed),
  adaptive_numbering = scale(adaptive_numbering),
  raven_2007_old = scale(raven_2007_old),
  math_2007_old = scale(math_2007_old),
  raven_2007_young = scale(raven_2007_young),
  math_2007_young = scale(math_2007_young),
  riskA = scale(riskA),
  riskB = scale(riskB),
  years_of_education_z = scale(years_of_education),
  Total_score_highest_z = scale(Total_score_highest),
  wage_last_month_z = scale(wage_last_month_log),
  wage_last_year_z = scale(wage_last_year_log),
  big5_ext = scale(big5_ext),
  big5_con = scale(big5_con),
  big5_agree = scale(big5_agree),
  big5_open = scale(big5_open),
  big5_neu = scale(big5_neu),
  attended_school = as.integer(attended_school),
  attended_school = ifelse(attended_school == 1, 0,
                           ifelse(attended_school == 2, 1, NA)))


### Birthorder and Sibling Count
birthorder = birthorder %>% 
  mutate(
# birthorder as factors with levels of 1, 2, 3, 4, 5, >5
    birthorder_naive_factor = as.character(birthorder_naive),
    birthorder_naive_factor = ifelse(birthorder_naive > 5, ">5",
                                            birthorder_naive_factor),
    birthorder_naive_factor = factor(birthorder_naive_factor, 
                                            levels = c("1","2","3","4","5",">5")),
    sibling_count_naive_factor = as.character(sibling_count_naive),
    sibling_count_naive_factor = ifelse(sibling_count_naive > 5, ">5",
                                               sibling_count_naive_factor),
    sibling_count_naive_factor = factor(sibling_count_naive_factor, 
                                               levels = c("2","3","4","5",">5")),

    birthorder_uterus_alive_factor = as.character(birthorder_uterus_alive),
    birthorder_uterus_alive_factor = ifelse(birthorder_uterus_alive > 5, ">5",
                                            birthorder_uterus_alive_factor),
    birthorder_uterus_alive_factor = factor(birthorder_uterus_alive_factor, 
                                            levels = c("1","2","3","4","5",">5")),
    sibling_count_uterus_alive_factor = as.character(sibling_count_uterus_alive),
    sibling_count_uterus_alive_factor = ifelse(sibling_count_uterus_alive > 5, ">5",
                                               sibling_count_uterus_alive_factor),
    sibling_count_uterus_alive_factor = factor(sibling_count_uterus_alive_factor, 
                                               levels = c("2","3","4","5",">5")),
    birthorder_uterus_preg_factor = as.character(birthorder_uterus_preg),
    birthorder_uterus_preg_factor = ifelse(birthorder_uterus_preg > 5, ">5",
                                           birthorder_uterus_preg_factor),
    birthorder_uterus_preg_factor = factor(birthorder_uterus_preg_factor,
                                           levels = c("1","2","3","4","5",">5")),
    sibling_count_uterus_preg_factor = as.character(sibling_count_uterus_preg),
    sibling_count_uterus_preg_factor = ifelse(sibling_count_uterus_preg > 5, ">5",
                                              sibling_count_uterus_preg_factor),
    sibling_count_uterus_preg_factor = factor(sibling_count_uterus_preg_factor, 
                                              levels = c("2","3","4","5",">5")),
    birthorder_genes_factor = as.character(birthorder_genes),
    birthorder_genes_factor = ifelse(birthorder_genes >5 , ">5", birthorder_genes_factor),
    birthorder_genes_factor = factor(birthorder_genes_factor, 
                                     levels = c("1","2","3","4","5",">5")),
    sibling_count_genes_factor = as.character(sibling_count_genes),
    sibling_count_genes_factor = ifelse(sibling_count_genes >5 , ">5",
                                        sibling_count_genes_factor),
    sibling_count_genes_factor = factor(sibling_count_genes_factor, 
                                        levels = c("2","3","4","5",">5")),
    # interaction birthorder * siblingcout for each birthorder
    count_birthorder_naive =
      factor(str_replace(as.character(interaction(birthorder_naive_factor,                                                              sibling_count_naive_factor)),
                        "\\.", "/"),
                                           levels =   c("1/2","2/2", "1/3",  "2/3",
                                                        "3/3", "1/4", "2/4", "3/4", "4/4",
                                                        "1/5", "2/5", "3/5", "4/5", "5/5",
                                                        "1/>5", "2/>5", "3/>5", "4/>5",
                                                        "5/>5", ">5/>5")),
    count_birthorder_uterus_alive =
      factor(str_replace(as.character(interaction(birthorder_uterus_alive_factor,                                                              sibling_count_uterus_alive_factor)),
                        "\\.", "/"),
                                           levels =   c("1/2","2/2", "1/3",  "2/3",
                                                        "3/3", "1/4", "2/4", "3/4", "4/4",
                                                        "1/5", "2/5", "3/5", "4/5", "5/5",
                                                        "1/>5", "2/>5", "3/>5", "4/>5",
                                                        "5/>5", ">5/>5")),
    count_birthorder_uterus_preg =
      factor(str_replace(as.character(interaction(birthorder_uterus_preg_factor,                                                              sibling_count_uterus_preg_factor)), 
                         "\\.", "/"),
                                           levels =   c("1/2","2/2", "1/3",  "2/3",
                                                        "3/3", "1/4", "2/4", "3/4", "4/4",
                                                        "1/5", "2/5", "3/5", "4/5", "5/5",
                                                        "1/>5", "2/>5", "3/>5", "4/>5",
                                                        "5/>5", ">5/>5")),
    count_birthorder_genes =
      factor(str_replace(as.character(interaction(birthorder_genes_factor,                                                              sibling_count_genes_factor)), "\\.", "/"),
                                           levels =   c("1/2","2/2", "1/3",  "2/3",
                                                        "3/3", "1/4", "2/4", "3/4", "4/4",
                                                        "1/5", "2/5", "3/5", "4/5", "5/5",
                                                        "1/>5", "2/>5", "3/>5", "4/>5",
                                                        "5/>5", ">5/>5")))

birthorder <- birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive)

Intelligence

g-factor 2015 old

birthorder <- birthorder %>% mutate(outcome = g_factor_2015_old)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count +
               (1 | mother_pidlink),
                   data = birthorder)


compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1911 0.2 0.9555 12937 0.3394 -0.2009 0.583
fixed NA poly(age, 3, raw = TRUE)1 0.0243 0.02056 1.182 12872 0.2371 -0.01598 0.06459
fixed NA poly(age, 3, raw = TRUE)2 -0.001017 0.0006584 -1.544 12882 0.1226 -0.002307 0.0002738
fixed NA poly(age, 3, raw = TRUE)3 0.000003728 0.000006632 0.5621 12904 0.5741 -0.000009271 0.00001673
fixed NA male 0.06205 0.01493 4.156 11916 0.00003257 0.03279 0.09131
fixed NA sibling_count3 0.03391 0.03437 0.9865 8796 0.3239 -0.03346 0.1013
fixed NA sibling_count4 -0.0006889 0.03585 -0.01922 8292 0.9847 -0.07095 0.06957
fixed NA sibling_count5 -0.001687 0.03755 -0.04492 7786 0.9642 -0.07528 0.07191
fixed NA sibling_count>5 -0.1915 0.02919 -6.56 8383 0.00000000005705 -0.2487 -0.1343
ran_pars mother_pidlink sd__(Intercept) 0.5824 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7438 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1824 0.2002 0.9114 12932 0.3621 -0.2099 0.5748
fixed NA birth_order -0.003077 0.00332 -0.9269 13491 0.354 -0.009583 0.003429
fixed NA poly(age, 3, raw = TRUE)1 0.02632 0.02067 1.273 12936 0.203 -0.0142 0.06684
fixed NA poly(age, 3, raw = TRUE)2 -0.001092 0.0006635 -1.646 13003 0.09983 -0.002393 0.0002085
fixed NA poly(age, 3, raw = TRUE)3 0.00000448 0.000006683 0.6704 13031 0.5026 -0.000008618 0.00001758
fixed NA male 0.06218 0.01493 4.164 11914 0.00003142 0.03292 0.09145
fixed NA sibling_count3 0.03436 0.03437 0.9997 8799 0.3175 -0.033 0.1017
fixed NA sibling_count4 0.001231 0.0359 0.0343 8343 0.9726 -0.06913 0.07159
fixed NA sibling_count5 0.001859 0.03773 0.04927 7893 0.9607 -0.07209 0.07581
fixed NA sibling_count>5 -0.18 0.0317 -5.679 9540 0.00000001392 -0.2422 -0.1179
ran_pars mother_pidlink sd__(Intercept) 0.582 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.744 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1974 0.2017 0.9789 13030 0.3276 -0.1979 0.5928
fixed NA poly(age, 3, raw = TRUE)1 0.02456 0.02074 1.184 12998 0.2363 -0.01608 0.0652
fixed NA poly(age, 3, raw = TRUE)2 -0.001027 0.0006661 -1.542 13061 0.1232 -0.002332 0.0002787
fixed NA poly(age, 3, raw = TRUE)3 0.000003763 0.000006717 0.5601 13102 0.5754 -0.000009403 0.00001693
fixed NA male 0.06205 0.01493 4.155 11911 0.00003274 0.03278 0.09131
fixed NA sibling_count3 0.03503 0.0347 1.01 9051 0.3128 -0.03298 0.103
fixed NA sibling_count4 0.005935 0.03659 0.1622 8837 0.8711 -0.06578 0.07765
fixed NA sibling_count5 0.001283 0.03871 0.03314 8517 0.9736 -0.07459 0.07716
fixed NA sibling_count>5 -0.1803 0.03284 -5.489 10296 0.00000004129 -0.2446 -0.1159
fixed NA birth_order_nonlinear2 -0.01433 0.02147 -0.6675 11566 0.5045 -0.05641 0.02775
fixed NA birth_order_nonlinear3 -0.0118 0.02501 -0.4716 10932 0.6372 -0.06082 0.03723
fixed NA birth_order_nonlinear4 -0.03464 0.0284 -1.22 10886 0.2226 -0.0903 0.02102
fixed NA birth_order_nonlinear5 0.01513 0.03228 0.4688 10781 0.6392 -0.04814 0.07841
fixed NA birth_order_nonlinear>5 -0.02847 0.02793 -1.019 12922 0.308 -0.08321 0.02627
ran_pars mother_pidlink sd__(Intercept) 0.5822 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.744 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1955 0.203 0.9634 13102 0.3354 -0.2023 0.5933
fixed NA poly(age, 3, raw = TRUE)1 0.02567 0.02079 1.235 13049 0.2169 -0.01507 0.06642
fixed NA poly(age, 3, raw = TRUE)2 -0.00106 0.0006683 -1.586 13115 0.1128 -0.00237 0.00025
fixed NA poly(age, 3, raw = TRUE)3 0.000004077 0.000006744 0.6046 13160 0.5454 -0.00000914 0.0000173
fixed NA male 0.06191 0.01493 4.145 11899 0.00003418 0.03264 0.09118
fixed NA count_birth_order2/2 -0.04118 0.04236 -0.9722 12345 0.331 -0.1242 0.04184
fixed NA count_birth_order1/3 0.02571 0.04281 0.6006 12456 0.5481 -0.0582 0.1096
fixed NA count_birth_order2/3 0.01942 0.04732 0.4103 12963 0.6816 -0.07334 0.1122
fixed NA count_birth_order3/3 0.0007667 0.05251 0.0146 13323 0.9883 -0.1021 0.1037
fixed NA count_birth_order1/4 -0.01819 0.04862 -0.374 12948 0.7084 -0.1135 0.07711
fixed NA count_birth_order2/4 0.01964 0.05083 0.3863 13147 0.6993 -0.08 0.1193
fixed NA count_birth_order3/4 -0.02461 0.05444 -0.4519 13381 0.6513 -0.1313 0.0821
fixed NA count_birth_order4/4 -0.059 0.05719 -1.032 13447 0.3022 -0.1711 0.05308
fixed NA count_birth_order1/5 -0.09978 0.05416 -1.842 13259 0.06544 -0.2059 0.006367
fixed NA count_birth_order2/5 -0.00005492 0.05667 -0.0009691 13379 0.9992 -0.1111 0.111
fixed NA count_birth_order3/5 0.003105 0.05811 0.05344 13443 0.9574 -0.1108 0.117
fixed NA count_birth_order4/5 -0.01033 0.06116 -0.1689 13479 0.8659 -0.1302 0.1095
fixed NA count_birth_order5/5 0.0591 0.06229 0.9489 13479 0.3427 -0.06298 0.1812
fixed NA count_birth_order1/>5 -0.1474 0.04374 -3.371 13431 0.000752 -0.2332 -0.06171
fixed NA count_birth_order2/>5 -0.2332 0.04485 -5.198 13471 0.0000002042 -0.3211 -0.1452
fixed NA count_birth_order3/>5 -0.1994 0.04399 -4.531 13469 0.000005911 -0.2856 -0.1131
fixed NA count_birth_order4/>5 -0.2272 0.04306 -5.276 13449 0.0000001338 -0.3116 -0.1428
fixed NA count_birth_order5/>5 -0.1914 0.04332 -4.419 13465 0.000009987 -0.2764 -0.1065
fixed NA count_birth_order>5/>5 -0.2187 0.03572 -6.122 11512 0.0000000009539 -0.2887 -0.1487
ran_pars mother_pidlink sd__(Intercept) 0.5821 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7439 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 35518 35600 -17748 35496 NA NA NA
12 35519 35609 -17747 35495 0.8602 1 0.3537
16 35524 35644 -17746 35492 2.576 4 0.631
26 35532 35728 -17740 35480 11.82 10 0.2971

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8339 0.3708 -2.249 5418 0.02455 -1.561 -0.1072
fixed NA poly(age, 3, raw = TRUE)1 0.1467 0.04203 3.489 5384 0.0004886 0.06427 0.229
fixed NA poly(age, 3, raw = TRUE)2 -0.004903 0.001499 -3.271 5361 0.001079 -0.007841 -0.001965
fixed NA poly(age, 3, raw = TRUE)3 0.00004724 0.00001697 2.784 5351 0.005384 0.00001399 0.0000805
fixed NA male -0.02065 0.02158 -0.9572 5211 0.3385 -0.06294 0.02164
fixed NA sibling_count3 0.0003067 0.03701 0.008289 4039 0.9934 -0.07222 0.07284
fixed NA sibling_count4 -0.0771 0.04036 -1.91 3743 0.05616 -0.1562 0.002002
fixed NA sibling_count5 -0.1511 0.04636 -3.26 3538 0.001126 -0.242 -0.06025
fixed NA sibling_count>5 -0.2821 0.04094 -6.891 3492 6.533e-12 -0.3624 -0.2019
ran_pars mother_pidlink sd__(Intercept) 0.5177 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6977 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8412 0.3708 -2.269 5416 0.02332 -1.568 -0.1145
fixed NA birth_order 0.009041 0.007302 1.238 5681 0.2157 -0.005271 0.02335
fixed NA poly(age, 3, raw = TRUE)1 0.146 0.04203 3.473 5385 0.0005188 0.0636 0.2284
fixed NA poly(age, 3, raw = TRUE)2 -0.004888 0.001499 -3.261 5362 0.001117 -0.007826 -0.00195
fixed NA poly(age, 3, raw = TRUE)3 0.00004746 0.00001697 2.797 5347 0.005177 0.0000142 0.00008071
fixed NA male -0.02114 0.02158 -0.9795 5210 0.3274 -0.06343 0.02116
fixed NA sibling_count3 -0.004319 0.0372 -0.1161 4053 0.9076 -0.07722 0.06858
fixed NA sibling_count4 -0.08824 0.04135 -2.134 3778 0.03293 -0.1693 -0.007188
fixed NA sibling_count5 -0.169 0.04857 -3.48 3665 0.0005071 -0.2642 -0.07383
fixed NA sibling_count>5 -0.3178 0.05005 -6.349 4053 0.0000000002406 -0.4159 -0.2197
ran_pars mother_pidlink sd__(Intercept) 0.518 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6974 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8705 0.3718 -2.341 5449 0.01925 -1.599 -0.1418
fixed NA poly(age, 3, raw = TRUE)1 0.1492 0.04209 3.546 5405 0.0003944 0.06675 0.2317
fixed NA poly(age, 3, raw = TRUE)2 -0.005006 0.001501 -3.336 5376 0.000857 -0.007947 -0.002064
fixed NA poly(age, 3, raw = TRUE)3 0.00004879 0.00001699 2.872 5356 0.004092 0.0000155 0.00008209
fixed NA male -0.02051 0.02158 -0.9504 5204 0.342 -0.06281 0.02179
fixed NA sibling_count3 -0.006197 0.0378 -0.164 4209 0.8698 -0.08028 0.06788
fixed NA sibling_count4 -0.08533 0.04264 -2.001 4040 0.04544 -0.1689 -0.001759
fixed NA sibling_count5 -0.175 0.05049 -3.466 4004 0.0005347 -0.2739 -0.07602
fixed NA sibling_count>5 -0.3206 0.05119 -6.263 4234 0.0000000004144 -0.421 -0.2203
fixed NA birth_order_nonlinear2 0.03959 0.02714 1.459 4385 0.1448 -0.01361 0.09279
fixed NA birth_order_nonlinear3 0.02682 0.03361 0.7981 4542 0.4249 -0.03905 0.09269
fixed NA birth_order_nonlinear4 0.0122 0.04178 0.292 4691 0.7703 -0.06969 0.09409
fixed NA birth_order_nonlinear5 0.09656 0.05185 1.862 4475 0.06265 -0.005073 0.1982
fixed NA birth_order_nonlinear>5 0.06261 0.05372 1.166 5388 0.2438 -0.04268 0.1679
ran_pars mother_pidlink sd__(Intercept) 0.5179 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6975 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8752 0.3728 -2.348 5450 0.01892 -1.606 -0.1446
fixed NA poly(age, 3, raw = TRUE)1 0.1489 0.04219 3.53 5397 0.0004186 0.06625 0.2316
fixed NA poly(age, 3, raw = TRUE)2 -0.004981 0.001505 -3.311 5370 0.0009373 -0.00793 -0.002032
fixed NA poly(age, 3, raw = TRUE)3 0.00004837 0.00001704 2.839 5353 0.00454 0.00001498 0.00008176
fixed NA male -0.02137 0.0216 -0.9894 5190 0.3225 -0.06371 0.02097
fixed NA count_birth_order2/2 0.05487 0.04968 1.105 4871 0.2694 -0.0425 0.1522
fixed NA count_birth_order1/3 -0.006477 0.04639 -0.1396 5611 0.889 -0.0974 0.08444
fixed NA count_birth_order2/3 0.04298 0.05006 0.8586 5747 0.3906 -0.05513 0.1411
fixed NA count_birth_order3/3 0.02919 0.0557 0.5241 5788 0.6003 -0.07999 0.1384
fixed NA count_birth_order1/4 -0.1094 0.05641 -1.939 5741 0.05254 -0.22 0.001176
fixed NA count_birth_order2/4 -0.02503 0.05803 -0.4314 5787 0.6662 -0.1388 0.08871
fixed NA count_birth_order3/4 -0.06345 0.06065 -1.046 5776 0.2955 -0.1823 0.05541
fixed NA count_birth_order4/4 -0.03422 0.06329 -0.5408 5767 0.5887 -0.1583 0.08982
fixed NA count_birth_order1/5 -0.1232 0.07517 -1.639 5781 0.1012 -0.2706 0.02409
fixed NA count_birth_order2/5 -0.0938 0.08081 -1.161 5673 0.2458 -0.2522 0.06458
fixed NA count_birth_order3/5 -0.1584 0.07568 -2.093 5702 0.03641 -0.3067 -0.01005
fixed NA count_birth_order4/5 -0.1877 0.07323 -2.563 5750 0.0104 -0.3312 -0.04416
fixed NA count_birth_order5/5 -0.1089 0.07511 -1.45 5726 0.1471 -0.2561 0.03829
fixed NA count_birth_order1/>5 -0.2572 0.07465 -3.446 5691 0.0005734 -0.4035 -0.1109
fixed NA count_birth_order2/>5 -0.373 0.07449 -5.008 5643 0.0000005675 -0.519 -0.227
fixed NA count_birth_order3/>5 -0.2644 0.07378 -3.583 5591 0.0003422 -0.409 -0.1198
fixed NA count_birth_order4/>5 -0.3211 0.06919 -4.641 5619 0.000003543 -0.4567 -0.1855
fixed NA count_birth_order5/>5 -0.1957 0.06586 -2.972 5637 0.002974 -0.3248 -0.06663
fixed NA count_birth_order>5/>5 -0.2531 0.05163 -4.903 5494 0.0000009697 -0.3543 -0.152
ran_pars mother_pidlink sd__(Intercept) 0.5182 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6977 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 14535 14608 -7257 14513 NA NA NA
12 14536 14616 -7256 14512 1.533 1 0.2156
16 14540 14647 -7254 14508 3.603 4 0.4623
26 14553 14727 -7251 14501 6.45 10 0.7761

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8021 0.3701 -2.168 5459 0.03024 -1.527 -0.07681
fixed NA poly(age, 3, raw = TRUE)1 0.1431 0.04197 3.41 5421 0.0006539 0.06086 0.2254
fixed NA poly(age, 3, raw = TRUE)2 -0.004819 0.001497 -3.219 5397 0.001293 -0.007753 -0.001885
fixed NA poly(age, 3, raw = TRUE)3 0.00004624 0.00001695 2.728 5386 0.006384 0.00001302 0.00007946
fixed NA male -0.02123 0.02151 -0.9869 5249 0.3237 -0.0634 0.02093
fixed NA sibling_count3 0.006856 0.03997 0.1715 4166 0.8638 -0.07149 0.0852
fixed NA sibling_count4 -0.0426 0.0426 -1 3920 0.3174 -0.1261 0.04089
fixed NA sibling_count5 -0.07804 0.04578 -1.705 3698 0.08831 -0.1678 0.01168
fixed NA sibling_count>5 -0.1916 0.04007 -4.783 3860 0.000001794 -0.2702 -0.1131
ran_pars mother_pidlink sd__(Intercept) 0.5208 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6974 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7996 0.3702 -2.16 5458 0.03081 -1.525 -0.07407
fixed NA birth_order -0.002276 0.006431 -0.354 5827 0.7234 -0.01488 0.01033
fixed NA poly(age, 3, raw = TRUE)1 0.1432 0.04197 3.412 5421 0.0006499 0.06094 0.2255
fixed NA poly(age, 3, raw = TRUE)2 -0.00482 0.001497 -3.219 5397 0.001293 -0.007754 -0.001885
fixed NA poly(age, 3, raw = TRUE)3 0.00004615 0.00001695 2.722 5382 0.0065 0.00001293 0.00007938
fixed NA male -0.02113 0.02152 -0.9817 5249 0.3263 -0.0633 0.02105
fixed NA sibling_count3 0.008026 0.04011 0.2001 4170 0.8414 -0.07059 0.08664
fixed NA sibling_count4 -0.03991 0.04327 -0.9224 3928 0.3564 -0.1247 0.0449
fixed NA sibling_count5 -0.07387 0.04727 -1.563 3750 0.1182 -0.1665 0.01878
fixed NA sibling_count>5 -0.183 0.04692 -3.9 4229 0.00009751 -0.275 -0.09105
ran_pars mother_pidlink sd__(Intercept) 0.5206 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6975 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8363 0.371 -2.254 5489 0.02424 -1.564 -0.1091
fixed NA poly(age, 3, raw = TRUE)1 0.1458 0.04202 3.469 5440 0.0005261 0.06341 0.2281
fixed NA poly(age, 3, raw = TRUE)2 -0.004913 0.001499 -3.278 5411 0.001053 -0.00785 -0.001975
fixed NA poly(age, 3, raw = TRUE)3 0.00004722 0.00001697 2.782 5393 0.005418 0.00001395 0.00008048
fixed NA male -0.02023 0.02152 -0.9401 5244 0.3472 -0.06242 0.02195
fixed NA sibling_count3 0.008151 0.04069 0.2003 4306 0.8412 -0.07159 0.0879
fixed NA sibling_count4 -0.03462 0.04449 -0.7782 4167 0.4365 -0.1218 0.05258
fixed NA sibling_count5 -0.0762 0.04905 -1.554 4063 0.1204 -0.1723 0.01993
fixed NA sibling_count>5 -0.1822 0.04805 -3.792 4413 0.0001514 -0.2764 -0.08804
fixed NA birth_order_nonlinear2 0.0345 0.02777 1.242 4518 0.2142 -0.01993 0.08893
fixed NA birth_order_nonlinear3 -0.005354 0.03358 -0.1595 4642 0.8733 -0.07117 0.06046
fixed NA birth_order_nonlinear4 -0.02399 0.0407 -0.5894 4817 0.5556 -0.1038 0.05579
fixed NA birth_order_nonlinear5 0.04948 0.0496 0.9975 4667 0.3186 -0.04774 0.1467
fixed NA birth_order_nonlinear>5 -0.009693 0.04843 -0.2002 5619 0.8414 -0.1046 0.08522
ran_pars mother_pidlink sd__(Intercept) 0.5206 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6975 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8476 0.3718 -2.28 5494 0.02267 -1.576 -0.1188
fixed NA poly(age, 3, raw = TRUE)1 0.1447 0.04207 3.438 5435 0.00059 0.0622 0.2271
fixed NA poly(age, 3, raw = TRUE)2 -0.004861 0.001501 -3.238 5408 0.00121 -0.007803 -0.001919
fixed NA poly(age, 3, raw = TRUE)3 0.00004649 0.000017 2.734 5391 0.006271 0.00001317 0.00007981
fixed NA male -0.02115 0.02153 -0.9822 5231 0.326 -0.06334 0.02105
fixed NA count_birth_order2/2 0.09269 0.05458 1.698 5017 0.0895 -0.01428 0.1997
fixed NA count_birth_order1/3 0.03991 0.05027 0.7939 5665 0.4273 -0.05862 0.1384
fixed NA count_birth_order2/3 0.02977 0.05389 0.5524 5789 0.5807 -0.07585 0.1354
fixed NA count_birth_order3/3 0.04257 0.06031 0.7058 5839 0.4803 -0.07564 0.1608
fixed NA count_birth_order1/4 -0.07608 0.05917 -1.286 5785 0.1986 -0.1921 0.03989
fixed NA count_birth_order2/4 0.08764 0.06018 1.456 5832 0.1454 -0.03032 0.2056
fixed NA count_birth_order3/4 -0.0303 0.065 -0.4661 5822 0.6411 -0.1577 0.0971
fixed NA count_birth_order4/4 -0.03003 0.06725 -0.4466 5821 0.6552 -0.1618 0.1018
fixed NA count_birth_order1/5 -0.0001437 0.06919 -0.002077 5837 0.9983 -0.1357 0.1355
fixed NA count_birth_order2/5 -0.01429 0.07426 -0.1925 5782 0.8474 -0.1598 0.1313
fixed NA count_birth_order3/5 -0.1014 0.07188 -1.411 5792 0.1584 -0.2423 0.03948
fixed NA count_birth_order4/5 -0.1037 0.07452 -1.391 5759 0.1641 -0.2497 0.04236
fixed NA count_birth_order5/5 -0.02898 0.07439 -0.3896 5767 0.6969 -0.1748 0.1168
fixed NA count_birth_order1/>5 -0.1089 0.06599 -1.65 5835 0.09905 -0.2382 0.02047
fixed NA count_birth_order2/>5 -0.2303 0.06883 -3.346 5750 0.0008244 -0.3652 -0.09542
fixed NA count_birth_order3/>5 -0.1537 0.06699 -2.294 5736 0.02182 -0.285 -0.02239
fixed NA count_birth_order4/>5 -0.1817 0.06466 -2.81 5752 0.00497 -0.3084 -0.05497
fixed NA count_birth_order5/>5 -0.1002 0.06589 -1.52 5664 0.1284 -0.2293 0.02896
fixed NA count_birth_order>5/>5 -0.1736 0.05057 -3.433 5562 0.0006013 -0.2727 -0.07449
ran_pars mother_pidlink sd__(Intercept) 0.5209 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6971 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 14682 14755 -7330 14660 NA NA NA
12 14684 14764 -7330 14660 0.1261 1 0.7225
16 14687 14794 -7328 14655 4.215 4 0.3777
26 14694 14868 -7321 14642 13.01 10 0.2232

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.9226 0.3751 -2.46 5314 0.01394 -1.658 -0.1875
fixed NA poly(age, 3, raw = TRUE)1 0.1559 0.04254 3.665 5280 0.0002495 0.07254 0.2393
fixed NA poly(age, 3, raw = TRUE)2 -0.005258 0.001517 -3.465 5254 0.0005345 -0.008231 -0.002284
fixed NA poly(age, 3, raw = TRUE)3 0.0000515 0.00001718 2.997 5240 0.002742 0.00001782 0.00008518
fixed NA male -0.02117 0.0218 -0.9713 5119 0.3314 -0.06389 0.02155
fixed NA sibling_count3 0.01472 0.03647 0.4035 4008 0.6866 -0.05677 0.0862
fixed NA sibling_count4 -0.06404 0.04 -1.601 3736 0.1095 -0.1424 0.01437
fixed NA sibling_count5 -0.1279 0.04754 -2.691 3450 0.007154 -0.2211 -0.03476
fixed NA sibling_count>5 -0.271 0.04142 -6.541 3409 0.00000000007002 -0.3522 -0.1898
ran_pars mother_pidlink sd__(Intercept) 0.5155 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6986 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.9298 0.3751 -2.479 5313 0.01321 -1.665 -0.1947
fixed NA birth_order 0.01005 0.007512 1.338 5537 0.181 -0.004672 0.02477
fixed NA poly(age, 3, raw = TRUE)1 0.1551 0.04254 3.646 5281 0.000269 0.07172 0.2385
fixed NA poly(age, 3, raw = TRUE)2 -0.005241 0.001517 -3.454 5255 0.0005566 -0.008214 -0.002267
fixed NA poly(age, 3, raw = TRUE)3 0.00005174 0.00001718 3.011 5237 0.002619 0.00001806 0.00008542
fixed NA male -0.0215 0.0218 -0.9866 5118 0.3239 -0.06422 0.02122
fixed NA sibling_count3 0.009523 0.03668 0.2596 4021 0.7952 -0.06237 0.08141
fixed NA sibling_count4 -0.07619 0.04102 -1.857 3784 0.06335 -0.1566 0.004212
fixed NA sibling_count5 -0.147 0.04963 -2.962 3564 0.003076 -0.2443 -0.04973
fixed NA sibling_count>5 -0.3101 0.0507 -6.116 4032 0.000000001052 -0.4095 -0.2107
ran_pars mother_pidlink sd__(Intercept) 0.5157 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6984 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.9568 0.3761 -2.544 5347 0.01098 -1.694 -0.2197
fixed NA poly(age, 3, raw = TRUE)1 0.1581 0.0426 3.711 5301 0.0002086 0.07459 0.2416
fixed NA poly(age, 3, raw = TRUE)2 -0.005346 0.001519 -3.519 5270 0.0004364 -0.008323 -0.002369
fixed NA poly(age, 3, raw = TRUE)3 0.0000529 0.0000172 3.075 5247 0.002118 0.00001918 0.00008662
fixed NA male -0.0212 0.0218 -0.9723 5112 0.3309 -0.06393 0.02153
fixed NA sibling_count3 0.00883 0.03729 0.2368 4177 0.8129 -0.06427 0.08192
fixed NA sibling_count4 -0.07612 0.04236 -1.797 4044 0.07238 -0.1591 0.006895
fixed NA sibling_count5 -0.1499 0.05142 -2.914 3864 0.003586 -0.2506 -0.04907
fixed NA sibling_count>5 -0.3102 0.05189 -5.978 4227 0.000000002442 -0.4119 -0.2085
fixed NA birth_order_nonlinear2 0.04352 0.02709 1.606 4296 0.1083 -0.00958 0.09662
fixed NA birth_order_nonlinear3 0.02617 0.03362 0.7785 4446 0.4363 -0.03972 0.09207
fixed NA birth_order_nonlinear4 0.0344 0.04292 0.8015 4559 0.4229 -0.04972 0.1185
fixed NA birth_order_nonlinear5 0.07337 0.05415 1.355 4375 0.1755 -0.03276 0.1795
fixed NA birth_order_nonlinear>5 0.06926 0.0553 1.252 5207 0.2105 -0.03912 0.1776
ran_pars mother_pidlink sd__(Intercept) 0.5155 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6987 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.9636 0.3773 -2.554 5349 0.01067 -1.703 -0.2242
fixed NA poly(age, 3, raw = TRUE)1 0.1579 0.04271 3.697 5297 0.0002206 0.07418 0.2416
fixed NA poly(age, 3, raw = TRUE)2 -0.005325 0.001524 -3.495 5268 0.0004781 -0.008311 -0.002339
fixed NA poly(age, 3, raw = TRUE)3 0.0000525 0.00001726 3.042 5248 0.002365 0.00001867 0.00008633
fixed NA male -0.02235 0.02182 -1.024 5097 0.3058 -0.06513 0.02042
fixed NA count_birth_order2/2 0.06086 0.04827 1.261 4697 0.2074 -0.03375 0.1555
fixed NA count_birth_order1/3 0.007247 0.04578 0.1583 5515 0.8742 -0.08247 0.09696
fixed NA count_birth_order2/3 0.0644 0.04994 1.29 5653 0.1973 -0.03348 0.1623
fixed NA count_birth_order3/3 0.04643 0.05471 0.8486 5674 0.3962 -0.0608 0.1537
fixed NA count_birth_order1/4 -0.09561 0.05654 -1.691 5649 0.09087 -0.2064 0.0152
fixed NA count_birth_order2/4 -0.0208 0.05792 -0.3592 5674 0.7195 -0.1343 0.09272
fixed NA count_birth_order3/4 -0.04594 0.06005 -0.765 5657 0.4443 -0.1636 0.07176
fixed NA count_birth_order4/4 -0.004906 0.06335 -0.07745 5632 0.9383 -0.1291 0.1192
fixed NA count_birth_order1/5 -0.1047 0.07511 -1.394 5672 0.1633 -0.252 0.04248
fixed NA count_birth_order2/5 -0.07203 0.08321 -0.8656 5534 0.3867 -0.2351 0.09106
fixed NA count_birth_order3/5 -0.1374 0.0791 -1.738 5567 0.08235 -0.2925 0.01759
fixed NA count_birth_order4/5 -0.1243 0.0766 -1.623 5620 0.1046 -0.2745 0.02578
fixed NA count_birth_order5/5 -0.112 0.08027 -1.395 5586 0.163 -0.2693 0.04534
fixed NA count_birth_order1/>5 -0.2309 0.07637 -3.024 5564 0.002509 -0.3806 -0.08123
fixed NA count_birth_order2/>5 -0.3469 0.07643 -4.539 5509 0.000005763 -0.4967 -0.1971
fixed NA count_birth_order3/>5 -0.2686 0.07462 -3.599 5471 0.0003218 -0.4149 -0.1223
fixed NA count_birth_order4/>5 -0.3014 0.07262 -4.15 5417 0.0000337 -0.4437 -0.1591
fixed NA count_birth_order5/>5 -0.2063 0.06741 -3.061 5498 0.002217 -0.3385 -0.07422
fixed NA count_birth_order>5/>5 -0.2356 0.05257 -4.482 5397 0.000007558 -0.3386 -0.1326
ran_pars mother_pidlink sd__(Intercept) 0.5157 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.699 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 14247 14320 -7112 14225 NA NA NA
12 14247 14327 -7111 14223 1.792 1 0.1807
16 14253 14359 -7110 14221 2.106 4 0.7163
26 14267 14440 -7108 14215 5.623 10 0.8458

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Raven 2015 old

birthorder <- birthorder %>% mutate(outcome = raven_2015_old)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2589 0.1483 -1.745 13929 0.08095 -0.5497 0.03184
fixed NA poly(age, 3, raw = TRUE)1 0.05817 0.01424 4.085 13917 0.00004427 0.03026 0.08608
fixed NA poly(age, 3, raw = TRUE)2 -0.001978 0.0004199 -4.709 13856 0.000002507 -0.002801 -0.001155
fixed NA poly(age, 3, raw = TRUE)3 0.00001287 0.000003875 3.32 13750 0.0009022 0.00000527 0.00002046
fixed NA male 0.1522 0.01535 9.916 13196 4.293e-23 0.1221 0.1823
fixed NA sibling_count3 0.03526 0.0328 1.075 9632 0.2824 -0.02903 0.09955
fixed NA sibling_count4 -0.001169 0.03399 -0.03439 8938 0.9726 -0.06778 0.06545
fixed NA sibling_count5 0.03681 0.03559 1.034 8256 0.301 -0.03294 0.1066
fixed NA sibling_count>5 -0.1097 0.02774 -3.955 9049 0.000077 -0.1641 -0.05535
ran_pars mother_pidlink sd__(Intercept) 0.4621 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8175 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2593 0.1483 -1.748 13928 0.08044 -0.5501 0.0314
fixed NA birth_order -0.006107 0.003326 -1.836 13743 0.06633 -0.01263 0.0004111
fixed NA poly(age, 3, raw = TRUE)1 0.06006 0.01428 4.207 13911 0.00002601 0.03208 0.08804
fixed NA poly(age, 3, raw = TRUE)2 -0.002051 0.0004218 -4.862 13823 0.000001175 -0.002877 -0.001224
fixed NA poly(age, 3, raw = TRUE)3 0.00001355 0.000003893 3.482 13690 0.0004996 0.000005924 0.00002118
fixed NA male 0.1523 0.01535 9.924 13197 3.93e-23 0.1222 0.1824
fixed NA sibling_count3 0.03641 0.0328 1.11 9645 0.267 -0.02788 0.1007
fixed NA sibling_count4 0.00274 0.03404 0.0805 9001 0.9358 -0.06398 0.06946
fixed NA sibling_count5 0.04392 0.03578 1.227 8376 0.2198 -0.02622 0.114
fixed NA sibling_count>5 -0.08692 0.03038 -2.861 10247 0.004227 -0.1465 -0.02738
ran_pars mother_pidlink sd__(Intercept) 0.4614 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8177 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2533 0.1487 -1.703 13924 0.08852 -0.5447 0.03815
fixed NA poly(age, 3, raw = TRUE)1 0.05911 0.01428 4.14 13910 0.0000349 0.03113 0.08709
fixed NA poly(age, 3, raw = TRUE)2 -0.002023 0.0004217 -4.798 13823 0.000001623 -0.00285 -0.001197
fixed NA poly(age, 3, raw = TRUE)3 0.00001335 0.000003894 3.429 13683 0.0006066 0.000005722 0.00002099
fixed NA male 0.1521 0.01535 9.913 13190 4.402e-23 0.122 0.1822
fixed NA sibling_count3 0.02663 0.03319 0.8024 9945 0.4223 -0.03841 0.09167
fixed NA sibling_count4 -0.00795 0.03484 -0.2282 9597 0.8195 -0.07624 0.06034
fixed NA sibling_count5 0.02496 0.03693 0.6759 9146 0.4991 -0.04742 0.09734
fixed NA sibling_count>5 -0.1004 0.0317 -3.166 11147 0.00155 -0.1625 -0.03823
fixed NA birth_order_nonlinear2 -0.01635 0.02205 -0.7413 12346 0.4585 -0.05957 0.02687
fixed NA birth_order_nonlinear3 0.03193 0.02594 1.231 11954 0.2184 -0.01891 0.08278
fixed NA birth_order_nonlinear4 -0.01247 0.02955 -0.4222 11946 0.6729 -0.07039 0.04544
fixed NA birth_order_nonlinear5 0.02924 0.03368 0.8682 11900 0.3853 -0.03677 0.09525
fixed NA birth_order_nonlinear>5 -0.04653 0.02843 -1.636 13682 0.1018 -0.1023 0.009197
ran_pars mother_pidlink sd__(Intercept) 0.4618 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8174 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.23 0.1493 -1.54 13913 0.1235 -0.5227 0.06267
fixed NA poly(age, 3, raw = TRUE)1 0.05915 0.01428 4.142 13898 0.00003458 0.03116 0.08713
fixed NA poly(age, 3, raw = TRUE)2 -0.002015 0.0004219 -4.777 13806 0.000001799 -0.002842 -0.001188
fixed NA poly(age, 3, raw = TRUE)3 0.0000132 0.000003896 3.389 13657 0.0007026 0.000005569 0.00002084
fixed NA male 0.1523 0.01535 9.921 13184 4.082e-23 0.1222 0.1824
fixed NA count_birth_order2/2 -0.08968 0.04298 -2.087 12674 0.03694 -0.1739 -0.005445
fixed NA count_birth_order1/3 0.001331 0.04216 0.03157 13409 0.9748 -0.0813 0.08396
fixed NA count_birth_order2/3 -0.01655 0.04682 -0.3534 13662 0.7238 -0.1083 0.07523
fixed NA count_birth_order3/3 0.02862 0.05232 0.547 13843 0.5844 -0.07393 0.1312
fixed NA count_birth_order1/4 -0.05712 0.04776 -1.196 13656 0.2318 -0.1507 0.03649
fixed NA count_birth_order2/4 -0.00643 0.0504 -0.1276 13758 0.8985 -0.1052 0.09234
fixed NA count_birth_order3/4 -0.003269 0.0545 -0.05998 13880 0.9522 -0.1101 0.1035
fixed NA count_birth_order4/4 -0.07443 0.05735 -1.298 13912 0.1943 -0.1868 0.03796
fixed NA count_birth_order1/5 -0.06156 0.05424 -1.135 13827 0.2564 -0.1679 0.04474
fixed NA count_birth_order2/5 0.001736 0.05671 0.03062 13883 0.9756 -0.1094 0.1129
fixed NA count_birth_order3/5 0.04451 0.05839 0.7622 13912 0.4459 -0.06993 0.1589
fixed NA count_birth_order4/5 -0.03346 0.06165 -0.5427 13925 0.5874 -0.1543 0.08738
fixed NA count_birth_order5/5 0.09651 0.06314 1.529 13921 0.1264 -0.02724 0.2203
fixed NA count_birth_order1/>5 -0.1224 0.04362 -2.805 13915 0.005039 -0.2078 -0.03686
fixed NA count_birth_order2/>5 -0.1417 0.04493 -3.153 13925 0.001617 -0.2297 -0.05362
fixed NA count_birth_order3/>5 -0.1007 0.04394 -2.291 13925 0.02199 -0.1868 -0.01454
fixed NA count_birth_order4/>5 -0.1217 0.04315 -2.82 13922 0.004806 -0.2063 -0.03712
fixed NA count_birth_order5/>5 -0.1216 0.04345 -2.798 13925 0.005143 -0.2067 -0.03643
fixed NA count_birth_order>5/>5 -0.174 0.0348 -5 12310 0.0000005819 -0.2422 -0.1058
ran_pars mother_pidlink sd__(Intercept) 0.4612 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8177 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 37283 37366 -18631 37261 NA NA NA
12 37282 37372 -18629 37258 3.375 1 0.06621
16 37283 37404 -18625 37251 6.817 4 0.1459
26 37293 37489 -18621 37241 9.765 10 0.4614

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5241 0.3667 -1.429 5788 0.153 -1.243 0.1946
fixed NA poly(age, 3, raw = TRUE)1 0.09035 0.04162 2.171 5785 0.02997 0.008782 0.1719
fixed NA poly(age, 3, raw = TRUE)2 -0.002746 0.001486 -1.849 5785 0.06455 -0.005658 0.0001652
fixed NA poly(age, 3, raw = TRUE)3 0.00002114 0.00001683 1.256 5789 0.2092 -0.00001185 0.00005412
fixed NA male 0.09392 0.02139 4.392 5674 0.00001146 0.052 0.1358
fixed NA sibling_count3 0.0296 0.03472 0.8526 4233 0.394 -0.03845 0.09766
fixed NA sibling_count4 -0.0397 0.03752 -1.058 3809 0.2901 -0.1132 0.03383
fixed NA sibling_count5 -0.08843 0.04313 -2.05 3485 0.04042 -0.173 -0.003891
fixed NA sibling_count>5 -0.1438 0.03792 -3.792 3348 0.0001518 -0.2181 -0.06949
ran_pars mother_pidlink sd__(Intercept) 0.3938 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7424 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5258 0.3668 -1.434 5786 0.1517 -1.245 0.193
fixed NA birth_order 0.002299 0.007146 0.3216 5923 0.7477 -0.01171 0.0163
fixed NA poly(age, 3, raw = TRUE)1 0.09021 0.04162 2.167 5784 0.03025 0.008632 0.1718
fixed NA poly(age, 3, raw = TRUE)2 -0.002745 0.001486 -1.848 5784 0.06472 -0.005657 0.000167
fixed NA poly(age, 3, raw = TRUE)3 0.00002121 0.00001683 1.26 5786 0.2077 -0.00001178 0.0000542
fixed NA male 0.09381 0.02139 4.386 5673 0.00001177 0.05188 0.1357
fixed NA sibling_count3 0.02845 0.03491 0.815 4241 0.4151 -0.03997 0.09687
fixed NA sibling_count4 -0.0424 0.03845 -1.103 3831 0.2702 -0.1178 0.03297
fixed NA sibling_count5 -0.09284 0.04527 -2.051 3592 0.04035 -0.1816 -0.004117
fixed NA sibling_count>5 -0.1526 0.04681 -3.261 3900 0.001121 -0.2444 -0.06089
ran_pars mother_pidlink sd__(Intercept) 0.394 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7423 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5665 0.3675 -1.541 5802 0.1233 -1.287 0.1539
fixed NA poly(age, 3, raw = TRUE)1 0.09346 0.04166 2.243 5792 0.02491 0.01181 0.1751
fixed NA poly(age, 3, raw = TRUE)2 -0.00286 0.001487 -1.923 5790 0.05454 -0.005774 0.00005512
fixed NA poly(age, 3, raw = TRUE)3 0.00002249 0.00001685 1.335 5790 0.182 -0.00001053 0.00005552
fixed NA male 0.09389 0.02139 4.389 5669 0.00001161 0.05196 0.1358
fixed NA sibling_count3 0.01664 0.03555 0.468 4419 0.6398 -0.05304 0.08633
fixed NA sibling_count4 -0.05847 0.03981 -1.469 4138 0.142 -0.1365 0.01957
fixed NA sibling_count5 -0.1133 0.04732 -2.394 3993 0.0167 -0.2061 -0.02056
fixed NA sibling_count>5 -0.1617 0.04806 -3.365 4136 0.0007719 -0.2559 -0.06754
fixed NA birth_order_nonlinear2 0.04528 0.02729 1.659 4735 0.09717 -0.008212 0.09877
fixed NA birth_order_nonlinear3 0.0584 0.03378 1.729 4941 0.08393 -0.007813 0.1246
fixed NA birth_order_nonlinear4 0.03984 0.04188 0.9514 5104 0.3415 -0.04224 0.1219
fixed NA birth_order_nonlinear5 0.05613 0.05225 1.074 4916 0.2827 -0.04627 0.1585
fixed NA birth_order_nonlinear>5 0.01605 0.05306 0.3025 5783 0.7623 -0.08795 0.12
ran_pars mother_pidlink sd__(Intercept) 0.3928 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7428 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5931 0.3685 -1.61 5797 0.1076 -1.315 0.1291
fixed NA poly(age, 3, raw = TRUE)1 0.09665 0.04176 2.314 5784 0.02068 0.0148 0.1785
fixed NA poly(age, 3, raw = TRUE)2 -0.002961 0.001491 -1.986 5783 0.04709 -0.005883 -0.00003867
fixed NA poly(age, 3, raw = TRUE)3 0.00002349 0.0000169 1.39 5784 0.1646 -0.000009634 0.00005661
fixed NA male 0.09428 0.02141 4.403 5659 0.00001087 0.05231 0.1363
fixed NA count_birth_order2/2 0.03312 0.04956 0.6683 5102 0.5039 -0.06401 0.1302
fixed NA count_birth_order1/3 -0.01387 0.04484 -0.3094 5827 0.757 -0.1018 0.07402
fixed NA count_birth_order2/3 0.08776 0.04873 1.801 5891 0.07174 -0.007741 0.1833
fixed NA count_birth_order3/3 0.08144 0.0544 1.497 5909 0.1345 -0.02519 0.1881
fixed NA count_birth_order1/4 -0.06891 0.05445 -1.265 5884 0.2057 -0.1756 0.03781
fixed NA count_birth_order2/4 -0.02435 0.05634 -0.4322 5909 0.6656 -0.1348 0.08608
fixed NA count_birth_order3/4 0.006464 0.05937 0.1089 5899 0.9133 -0.1099 0.1228
fixed NA count_birth_order4/4 -0.0157 0.06178 -0.2541 5897 0.7994 -0.1368 0.1054
fixed NA count_birth_order1/5 -0.05962 0.07384 -0.8075 5906 0.4194 -0.2043 0.0851
fixed NA count_birth_order2/5 -0.04247 0.07901 -0.5376 5853 0.5909 -0.1973 0.1124
fixed NA count_birth_order3/5 -0.05223 0.07429 -0.703 5863 0.4821 -0.1978 0.09337
fixed NA count_birth_order4/5 -0.1066 0.07177 -1.486 5884 0.1374 -0.2473 0.03402
fixed NA count_birth_order5/5 -0.1237 0.07425 -1.666 5866 0.09572 -0.2692 0.02181
fixed NA count_birth_order1/>5 -0.1206 0.07347 -1.642 5868 0.1007 -0.2646 0.02337
fixed NA count_birth_order2/>5 -0.1956 0.07265 -2.693 5846 0.007103 -0.338 -0.05325
fixed NA count_birth_order3/>5 -0.1502 0.07269 -2.066 5800 0.0389 -0.2926 -0.007687
fixed NA count_birth_order4/>5 -0.1115 0.06833 -1.631 5806 0.1029 -0.2454 0.02246
fixed NA count_birth_order5/>5 -0.06799 0.06468 -1.051 5817 0.2932 -0.1948 0.05878
fixed NA count_birth_order>5/>5 -0.1493 0.0495 -3.016 5523 0.002577 -0.2463 -0.05226
ran_pars mother_pidlink sd__(Intercept) 0.3924 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7433 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 14652 14726 -7315 14630 NA NA NA
12 14654 14734 -7315 14630 0.1023 1 0.7491
16 14657 14764 -7313 14625 4.598 4 0.3311
26 14671 14844 -7309 14619 6.858 10 0.7388

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.4997 0.3654 -1.367 5839 0.1716 -1.216 0.2166
fixed NA poly(age, 3, raw = TRUE)1 0.08706 0.04149 2.098 5834 0.03592 0.005739 0.1684
fixed NA poly(age, 3, raw = TRUE)2 -0.002669 0.001481 -1.801 5833 0.0717 -0.005572 0.000235
fixed NA poly(age, 3, raw = TRUE)3 0.0000203 0.00001679 1.209 5838 0.2266 -0.0000126 0.0000532
fixed NA male 0.09351 0.02129 4.392 5722 0.00001146 0.05178 0.1352
fixed NA sibling_count3 0.03147 0.0375 0.8392 4389 0.4014 -0.04204 0.105
fixed NA sibling_count4 -0.009716 0.03964 -0.2451 4039 0.8064 -0.08741 0.06797
fixed NA sibling_count5 -0.01839 0.04258 -0.4318 3719 0.6659 -0.1019 0.06508
fixed NA sibling_count>5 -0.0805 0.03731 -2.157 3862 0.03103 -0.1536 -0.007369
ran_pars mother_pidlink sd__(Intercept) 0.3954 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7416 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.4938 0.3655 -1.351 5839 0.1768 -1.21 0.2226
fixed NA birth_order -0.005347 0.006257 -0.8546 5930 0.3928 -0.01761 0.006915
fixed NA poly(age, 3, raw = TRUE)1 0.08718 0.0415 2.101 5834 0.03568 0.005853 0.1685
fixed NA poly(age, 3, raw = TRUE)2 -0.002665 0.001482 -1.799 5833 0.07212 -0.005569 0.000239
fixed NA poly(age, 3, raw = TRUE)3 0.00002004 0.00001679 1.193 5836 0.2329 -0.00001288 0.00005295
fixed NA male 0.09375 0.0213 4.402 5723 0.00001092 0.05201 0.1355
fixed NA sibling_count3 0.03414 0.03762 0.9075 4389 0.3642 -0.0396 0.1079
fixed NA sibling_count4 -0.003681 0.04025 -0.09145 4036 0.9271 -0.08257 0.07521
fixed NA sibling_count5 -0.008885 0.044 -0.2019 3753 0.84 -0.09513 0.07736
fixed NA sibling_count>5 -0.06066 0.04394 -1.381 4203 0.1675 -0.1468 0.02546
ran_pars mother_pidlink sd__(Intercept) 0.3946 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7419 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5303 0.3662 -1.448 5853 0.1477 -1.248 0.1875
fixed NA poly(age, 3, raw = TRUE)1 0.08914 0.04153 2.146 5842 0.03189 0.00774 0.1705
fixed NA poly(age, 3, raw = TRUE)2 -0.002734 0.001483 -1.844 5840 0.06528 -0.005641 0.0001724
fixed NA poly(age, 3, raw = TRUE)3 0.00002084 0.00001681 1.24 5841 0.2152 -0.00001211 0.00005378
fixed NA male 0.09355 0.0213 4.391 5720 0.00001148 0.05179 0.1353
fixed NA sibling_count3 0.02214 0.03824 0.579 4541 0.5626 -0.05281 0.09708
fixed NA sibling_count4 -0.02317 0.04153 -0.558 4308 0.5769 -0.1046 0.05823
fixed NA sibling_count5 -0.03049 0.04591 -0.6641 4121 0.5066 -0.1205 0.05949
fixed NA sibling_count>5 -0.07221 0.04516 -1.599 4447 0.1099 -0.1607 0.0163
fixed NA birth_order_nonlinear2 0.036 0.02783 1.294 4879 0.1959 -0.01855 0.09056
fixed NA birth_order_nonlinear3 0.04407 0.03368 1.309 5071 0.1907 -0.02194 0.1101
fixed NA birth_order_nonlinear4 0.03472 0.04065 0.8542 5249 0.393 -0.04494 0.1144
fixed NA birth_order_nonlinear5 0.01614 0.04974 0.3245 5143 0.7456 -0.08135 0.1136
fixed NA birth_order_nonlinear>5 -0.03226 0.04754 -0.6786 5933 0.4974 -0.1254 0.06092
ran_pars mother_pidlink sd__(Intercept) 0.3933 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7425 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.527 0.3668 -1.437 5847 0.1509 -1.246 0.192
fixed NA poly(age, 3, raw = TRUE)1 0.08859 0.04158 2.131 5831 0.03316 0.007097 0.1701
fixed NA poly(age, 3, raw = TRUE)2 -0.002699 0.001485 -1.817 5829 0.06921 -0.005609 0.0002117
fixed NA poly(age, 3, raw = TRUE)3 0.00002026 0.00001683 1.203 5832 0.2288 -0.00001273 0.00005325
fixed NA male 0.09351 0.0213 4.389 5705 0.00001157 0.05176 0.1353
fixed NA count_birth_order2/2 0.03047 0.05428 0.5614 5243 0.5745 -0.07591 0.1369
fixed NA count_birth_order1/3 -0.005049 0.0485 -0.1041 5879 0.9171 -0.1001 0.09001
fixed NA count_birth_order2/3 0.07102 0.05237 1.356 5939 0.1751 -0.03162 0.1737
fixed NA count_birth_order3/3 0.09355 0.05888 1.589 5962 0.1121 -0.02185 0.209
fixed NA count_birth_order1/4 -0.07743 0.05693 -1.36 5934 0.1738 -0.189 0.03414
fixed NA count_birth_order2/4 0.04346 0.05822 0.7466 5959 0.4554 -0.07064 0.1576
fixed NA count_birth_order3/4 0.04852 0.0635 0.7642 5951 0.4448 -0.07593 0.173
fixed NA count_birth_order4/4 0.01437 0.06557 0.2191 5953 0.8266 -0.1142 0.1429
fixed NA count_birth_order1/5 0.02045 0.06753 0.3029 5961 0.762 -0.1119 0.1528
fixed NA count_birth_order2/5 0.05005 0.07271 0.6884 5933 0.4912 -0.09246 0.1926
fixed NA count_birth_order3/5 -0.02403 0.07055 -0.3406 5935 0.7334 -0.1623 0.1143
fixed NA count_birth_order4/5 -0.03049 0.07305 -0.4174 5915 0.6764 -0.1737 0.1127
fixed NA count_birth_order5/5 -0.06213 0.07291 -0.8522 5922 0.3941 -0.205 0.08076
fixed NA count_birth_order1/>5 0.008191 0.06447 0.127 5961 0.8989 -0.1182 0.1345
fixed NA count_birth_order2/>5 -0.146 0.06705 -2.177 5922 0.02949 -0.2774 -0.01458
fixed NA count_birth_order3/>5 -0.06925 0.06562 -1.055 5907 0.2913 -0.1979 0.05935
fixed NA count_birth_order4/>5 -0.02285 0.06336 -0.3607 5909 0.7184 -0.147 0.1013
fixed NA count_birth_order5/>5 -0.02685 0.06489 -0.4137 5852 0.6791 -0.154 0.1003
fixed NA count_birth_order>5/>5 -0.1068 0.04849 -2.204 5614 0.02759 -0.2019 -0.01182
ran_pars mother_pidlink sd__(Intercept) 0.3949 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7416 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 14783 14856 -7380 14761 NA NA NA
12 14784 14864 -7380 14760 0.7334 1 0.3918
16 14788 14895 -7378 14756 3.844 4 0.4275
26 14795 14969 -7371 14743 13.4 10 0.202

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5761 0.3711 -1.552 5678 0.1206 -1.303 0.1513
fixed NA poly(age, 3, raw = TRUE)1 0.09716 0.04213 2.306 5675 0.02115 0.01458 0.1797
fixed NA poly(age, 3, raw = TRUE)2 -0.003018 0.001504 -2.006 5673 0.04491 -0.005966 -0.00006911
fixed NA poly(age, 3, raw = TRUE)3 0.00002451 0.00001705 1.437 5676 0.1507 -0.000008914 0.00005793
fixed NA male 0.09125 0.02161 4.222 5570 0.00002462 0.04889 0.1336
fixed NA sibling_count3 0.01999 0.03422 0.5842 4169 0.5591 -0.04708 0.08707
fixed NA sibling_count4 -0.03413 0.03724 -0.9165 3759 0.3595 -0.1071 0.03886
fixed NA sibling_count5 -0.08933 0.0442 -2.021 3351 0.04336 -0.176 -0.002698
fixed NA sibling_count>5 -0.1448 0.03831 -3.779 3215 0.00016 -0.2199 -0.06971
ran_pars mother_pidlink sd__(Intercept) 0.3902 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7437 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5775 0.3712 -1.556 5677 0.1198 -1.305 0.1499
fixed NA birth_order 0.002238 0.007356 0.3042 5802 0.761 -0.01218 0.01666
fixed NA poly(age, 3, raw = TRUE)1 0.097 0.04214 2.302 5674 0.02138 0.01441 0.1796
fixed NA poly(age, 3, raw = TRUE)2 -0.003016 0.001505 -2.004 5672 0.04508 -0.005964 -0.00006674
fixed NA poly(age, 3, raw = TRUE)3 0.00002458 0.00001706 1.441 5674 0.1496 -0.00000885 0.00005801
fixed NA male 0.09118 0.02162 4.218 5568 0.00002501 0.04882 0.1336
fixed NA sibling_count3 0.01887 0.03442 0.5481 4174 0.5837 -0.0486 0.08634
fixed NA sibling_count4 -0.03673 0.03821 -0.9612 3791 0.3365 -0.1116 0.03816
fixed NA sibling_count5 -0.09345 0.04623 -2.022 3448 0.0433 -0.184 -0.002845
fixed NA sibling_count>5 -0.1533 0.04742 -3.233 3844 0.001236 -0.2462 -0.06036
ran_pars mother_pidlink sd__(Intercept) 0.3905 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7437 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.6256 0.3718 -1.683 5691 0.09253 -1.354 0.1032
fixed NA poly(age, 3, raw = TRUE)1 0.1004 0.04217 2.382 5682 0.01725 0.0178 0.1831
fixed NA poly(age, 3, raw = TRUE)2 -0.003136 0.001506 -2.083 5678 0.03731 -0.006087 -0.000185
fixed NA poly(age, 3, raw = TRUE)3 0.00002589 0.00001707 1.517 5677 0.1293 -0.000007558 0.00005935
fixed NA male 0.0914 0.02162 4.228 5564 0.00002394 0.04903 0.1338
fixed NA sibling_count3 0.008164 0.03508 0.2327 4353 0.816 -0.06059 0.07692
fixed NA sibling_count4 -0.05403 0.03961 -1.364 4097 0.1727 -0.1317 0.02361
fixed NA sibling_count5 -0.1078 0.04814 -2.239 3804 0.02522 -0.2021 -0.01343
fixed NA sibling_count>5 -0.1591 0.04873 -3.265 4097 0.001103 -0.2546 -0.0636
fixed NA birth_order_nonlinear2 0.06079 0.02726 2.23 4637 0.02578 0.007365 0.1142
fixed NA birth_order_nonlinear3 0.05707 0.03379 1.689 4822 0.09131 -0.00916 0.1233
fixed NA birth_order_nonlinear4 0.05315 0.04308 1.234 4972 0.2174 -0.03129 0.1376
fixed NA birth_order_nonlinear5 0.02966 0.05454 0.5438 4817 0.5866 -0.07724 0.1366
fixed NA birth_order_nonlinear>5 0.02338 0.05469 0.4275 5627 0.669 -0.08381 0.1306
ran_pars mother_pidlink sd__(Intercept) 0.3892 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7441 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.6437 0.3729 -1.726 5687 0.08436 -1.375 0.08717
fixed NA poly(age, 3, raw = TRUE)1 0.1026 0.04228 2.427 5675 0.01527 0.01973 0.1855
fixed NA poly(age, 3, raw = TRUE)2 -0.003204 0.00151 -2.122 5672 0.03389 -0.006164 -0.0002446
fixed NA poly(age, 3, raw = TRUE)3 0.00002657 0.00001712 1.552 5673 0.1208 -0.000006992 0.00006013
fixed NA male 0.09147 0.02164 4.227 5553 0.0000241 0.04905 0.1339
fixed NA count_birth_order2/2 0.05327 0.04822 1.105 4942 0.2693 -0.04123 0.1478
fixed NA count_birth_order1/3 -0.01454 0.04425 -0.3286 5715 0.7425 -0.1013 0.07219
fixed NA count_birth_order2/3 0.09972 0.04866 2.049 5781 0.04046 0.004357 0.1951
fixed NA count_birth_order3/3 0.05742 0.05341 1.075 5790 0.2824 -0.04726 0.1621
fixed NA count_birth_order1/4 -0.0668 0.05467 -1.222 5776 0.2219 -0.174 0.04036
fixed NA count_birth_order2/4 -0.003471 0.05641 -0.06154 5790 0.9509 -0.114 0.1071
fixed NA count_birth_order3/4 0.0155 0.05882 0.2634 5778 0.7922 -0.0998 0.1308
fixed NA count_birth_order4/4 0.004197 0.06202 0.06768 5767 0.946 -0.1174 0.1257
fixed NA count_birth_order1/5 -0.05474 0.07389 -0.7408 5789 0.4588 -0.1996 0.09008
fixed NA count_birth_order2/5 -0.04276 0.08163 -0.5239 5725 0.6004 -0.2028 0.1172
fixed NA count_birth_order3/5 -0.04845 0.07764 -0.624 5735 0.5326 -0.2006 0.1037
fixed NA count_birth_order4/5 -0.07973 0.07529 -1.059 5758 0.2897 -0.2273 0.06784
fixed NA count_birth_order5/5 -0.1367 0.07946 -1.72 5737 0.08545 -0.2924 0.01905
fixed NA count_birth_order1/>5 -0.1208 0.0752 -1.607 5743 0.1081 -0.2682 0.02654
fixed NA count_birth_order2/>5 -0.1781 0.07448 -2.391 5721 0.01683 -0.3241 -0.03211
fixed NA count_birth_order3/>5 -0.1208 0.07353 -1.643 5680 0.1004 -0.2649 0.02331
fixed NA count_birth_order4/>5 -0.1009 0.07186 -1.404 5640 0.1603 -0.2417 0.03994
fixed NA count_birth_order5/>5 -0.09842 0.06622 -1.486 5687 0.1372 -0.2282 0.03136
fixed NA count_birth_order>5/>5 -0.1381 0.0504 -2.74 5392 0.006161 -0.2369 -0.03932
ran_pars mother_pidlink sd__(Intercept) 0.3886 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7447 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 14356 14429 -7167 14334 NA NA NA
12 14358 14438 -7167 14334 0.09157 1 0.7622
16 14360 14467 -7164 14328 6.1 4 0.1918
26 14375 14548 -7161 14323 5.282 10 0.8716

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Numeracy 2015 old

birthorder <- birthorder %>% mutate(outcome = math_2015_old)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3193 0.2143 1.49 13784 0.1362 -0.1007 0.7392
fixed NA poly(age, 3, raw = TRUE)1 0.007294 0.02199 0.3316 13792 0.7402 -0.03581 0.0504
fixed NA poly(age, 3, raw = TRUE)2 -0.0005758 0.0007025 -0.8196 13807 0.4124 -0.001953 0.0008011
fixed NA poly(age, 3, raw = TRUE)3 0.000004245 0.000007055 0.6017 13815 0.5474 -0.000009582 0.00001807
fixed NA male -0.07804 0.01633 -4.778 13293 0.000001792 -0.11 -0.04602
fixed NA sibling_count3 0.03562 0.03434 1.037 9605 0.2997 -0.03169 0.1029
fixed NA sibling_count4 -0.04503 0.03547 -1.27 8825 0.2042 -0.1145 0.02448
fixed NA sibling_count5 -0.01284 0.03704 -0.3466 8040 0.7289 -0.08544 0.05976
fixed NA sibling_count>5 -0.1715 0.02895 -5.922 8946 0.000000003304 -0.2282 -0.1147
ran_pars mother_pidlink sd__(Intercept) 0.4447 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.881 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3021 0.2145 1.409 13785 0.1589 -0.1182 0.7225
fixed NA birth_order -0.006092 0.003514 -1.734 13386 0.08303 -0.01298 0.0007958
fixed NA poly(age, 3, raw = TRUE)1 0.01092 0.02209 0.4941 13820 0.6212 -0.03238 0.05422
fixed NA poly(age, 3, raw = TRUE)2 -0.0007057 0.0007065 -0.9988 13848 0.3179 -0.00209 0.0006791
fixed NA poly(age, 3, raw = TRUE)3 0.000005524 0.000007093 0.7787 13856 0.4362 -0.000008379 0.00001943
fixed NA male -0.07783 0.01633 -4.765 13294 0.000001906 -0.1098 -0.04582
fixed NA sibling_count3 0.03689 0.03434 1.074 9620 0.2827 -0.03042 0.1042
fixed NA sibling_count4 -0.04087 0.03554 -1.15 8893 0.2502 -0.1105 0.02879
fixed NA sibling_count5 -0.005543 0.03727 -0.1487 8162 0.8818 -0.07859 0.0675
fixed NA sibling_count>5 -0.1485 0.03184 -4.664 10121 0.000003137 -0.2109 -0.08609
ran_pars mother_pidlink sd__(Intercept) 0.4442 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8811 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3361 0.2158 1.558 13816 0.1193 -0.0868 0.7591
fixed NA poly(age, 3, raw = TRUE)1 0.006561 0.02214 0.2963 13834 0.767 -0.03683 0.04995
fixed NA poly(age, 3, raw = TRUE)2 -0.0005546 0.0007086 -0.7827 13859 0.4338 -0.001943 0.0008343
fixed NA poly(age, 3, raw = TRUE)3 0.000004035 0.000007122 0.5665 13869 0.571 -0.000009925 0.000018
fixed NA male -0.0781 0.01634 -4.781 13289 0.000001761 -0.1101 -0.04609
fixed NA sibling_count3 0.03465 0.03477 0.9965 9939 0.319 -0.0335 0.1028
fixed NA sibling_count4 -0.05003 0.03642 -1.374 9533 0.1696 -0.1214 0.02136
fixed NA sibling_count5 -0.02144 0.03854 -0.5564 8989 0.578 -0.09697 0.05409
fixed NA sibling_count>5 -0.1731 0.03329 -5.201 11107 0.0000002017 -0.2384 -0.1079
fixed NA birth_order_nonlinear2 -0.02299 0.02364 -0.9727 12407 0.3307 -0.06933 0.02334
fixed NA birth_order_nonlinear3 -0.002078 0.02775 -0.07488 11992 0.9403 -0.05647 0.05232
fixed NA birth_order_nonlinear4 0.01697 0.03155 0.5378 11980 0.5907 -0.04487 0.07881
fixed NA birth_order_nonlinear5 0.01641 0.03594 0.4564 11936 0.6481 -0.05404 0.08685
fixed NA birth_order_nonlinear>5 -0.01964 0.03019 -0.6505 13718 0.5154 -0.0788 0.03953
ran_pars mother_pidlink sd__(Intercept) 0.4443 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8812 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3273 0.217 1.509 13830 0.1314 -0.09794 0.7526
fixed NA poly(age, 3, raw = TRUE)1 0.006943 0.02219 0.3129 13840 0.7543 -0.03654 0.05043
fixed NA poly(age, 3, raw = TRUE)2 -0.0005669 0.0007105 -0.7979 13862 0.425 -0.00196 0.0008257
fixed NA poly(age, 3, raw = TRUE)3 0.000004164 0.000007146 0.5828 13870 0.5601 -0.000009841 0.00001817
fixed NA male -0.07788 0.01634 -4.766 13281 0.0000019 -0.1099 -0.04585
fixed NA count_birth_order2/2 -0.00982 0.04618 -0.2127 12703 0.8316 -0.1003 0.08068
fixed NA count_birth_order1/3 0.05031 0.04467 1.126 13464 0.2601 -0.03724 0.1379
fixed NA count_birth_order2/3 0.01198 0.04969 0.2411 13653 0.8095 -0.08541 0.1094
fixed NA count_birth_order3/3 0.0213 0.05561 0.3831 13805 0.7016 -0.08768 0.1303
fixed NA count_birth_order1/4 -0.05016 0.05062 -0.9909 13664 0.3218 -0.1494 0.04906
fixed NA count_birth_order2/4 -0.06037 0.05338 -1.131 13741 0.2581 -0.165 0.04425
fixed NA count_birth_order3/4 -0.03141 0.05772 -0.5442 13835 0.5863 -0.1445 0.08172
fixed NA count_birth_order4/4 -0.04884 0.06074 -0.8041 13865 0.4213 -0.1679 0.0702
fixed NA count_birth_order1/5 -0.05318 0.05742 -0.9263 13802 0.3543 -0.1657 0.05935
fixed NA count_birth_order2/5 -0.08221 0.06012 -1.367 13844 0.1715 -0.2 0.03562
fixed NA count_birth_order3/5 0.01386 0.06183 0.2241 13866 0.8227 -0.1073 0.1351
fixed NA count_birth_order4/5 0.01906 0.06531 0.2918 13877 0.7704 -0.1089 0.1471
fixed NA count_birth_order5/5 0.05706 0.06688 0.8531 13873 0.3936 -0.07403 0.1881
fixed NA count_birth_order1/>5 -0.1509 0.04641 -3.251 13867 0.001153 -0.2418 -0.05991
fixed NA count_birth_order2/>5 -0.1789 0.04772 -3.75 13877 0.0001776 -0.2725 -0.08542
fixed NA count_birth_order3/>5 -0.183 0.04667 -3.921 13877 0.00008855 -0.2744 -0.09152
fixed NA count_birth_order4/>5 -0.1483 0.04581 -3.238 13876 0.001208 -0.2381 -0.05853
fixed NA count_birth_order5/>5 -0.1708 0.04611 -3.705 13877 0.0002124 -0.2612 -0.08044
fixed NA count_birth_order>5/>5 -0.1879 0.03668 -5.123 12289 0.0000003045 -0.2598 -0.116
ran_pars mother_pidlink sd__(Intercept) 0.444 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8815 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 38695 38778 -19337 38673 NA NA NA
12 38694 38785 -19335 38670 3.008 1 0.08286
16 38702 38823 -19335 38670 0.06628 4 0.9995
26 38718 38914 -19333 38666 4.383 10 0.9284

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.4124 0.4482 -0.92 5845 0.3576 -1.291 0.4662
fixed NA poly(age, 3, raw = TRUE)1 0.09996 0.05087 1.965 5846 0.04947 0.0002534 0.1997
fixed NA poly(age, 3, raw = TRUE)2 -0.003619 0.001816 -1.993 5850 0.04632 -0.007178 -0.00005981
fixed NA poly(age, 3, raw = TRUE)3 0.00003836 0.00002057 1.865 5855 0.06226 -0.000001958 0.00007868
fixed NA male -0.1536 0.02616 -5.869 5765 0.000000004617 -0.2048 -0.1023
fixed NA sibling_count3 0.01062 0.04193 0.2533 4427 0.8001 -0.07156 0.0928
fixed NA sibling_count4 -0.08796 0.04522 -1.945 3988 0.05182 -0.1766 0.0006691
fixed NA sibling_count5 -0.1347 0.05191 -2.594 3643 0.009518 -0.2364 -0.03293
fixed NA sibling_count>5 -0.2428 0.04561 -5.325 3482 0.0000001076 -0.3322 -0.1534
ran_pars mother_pidlink sd__(Intercept) 0.4377 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.923 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.4249 0.4482 -0.9481 5844 0.3431 -1.303 0.4535
fixed NA birth_order 0.01582 0.008711 1.817 5914 0.06933 -0.001249 0.0329
fixed NA poly(age, 3, raw = TRUE)1 0.09906 0.05086 1.948 5846 0.0515 -0.0006253 0.1988
fixed NA poly(age, 3, raw = TRUE)2 -0.003611 0.001816 -1.989 5849 0.04676 -0.007169 -0.00005259
fixed NA poly(age, 3, raw = TRUE)3 0.00003891 0.00002057 1.892 5853 0.0586 -0.000001407 0.00007922
fixed NA male -0.1543 0.02616 -5.898 5765 0.000000003898 -0.2056 -0.103
fixed NA sibling_count3 0.002788 0.04214 0.06616 4435 0.9473 -0.07981 0.08539
fixed NA sibling_count4 -0.1064 0.04634 -2.296 4008 0.02172 -0.1972 -0.01558
fixed NA sibling_count5 -0.1648 0.05449 -3.024 3744 0.002508 -0.2716 -0.05801
fixed NA sibling_count>5 -0.3032 0.05643 -5.374 4014 0.00000008157 -0.4138 -0.1926
ran_pars mother_pidlink sd__(Intercept) 0.4378 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9227 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.4289 0.4491 -0.955 5852 0.3396 -1.309 0.4513
fixed NA poly(age, 3, raw = TRUE)1 0.1012 0.05091 1.987 5850 0.04695 0.001384 0.2009
fixed NA poly(age, 3, raw = TRUE)2 -0.003688 0.001817 -2.029 5851 0.04247 -0.00725 -0.0001261
fixed NA poly(age, 3, raw = TRUE)3 0.00003982 0.00002059 1.934 5854 0.0532 -0.0000005415 0.00008018
fixed NA male -0.1543 0.02617 -5.895 5760 0.000000003967 -0.2055 -0.103
fixed NA sibling_count3 -0.006667 0.04296 -0.1552 4608 0.8767 -0.09088 0.07754
fixed NA sibling_count4 -0.1178 0.04805 -2.451 4313 0.01427 -0.212 -0.02361
fixed NA sibling_count5 -0.1912 0.05708 -3.35 4147 0.0008158 -0.3031 -0.07933
fixed NA sibling_count>5 -0.317 0.058 -5.465 4255 0.00000004897 -0.4306 -0.2033
fixed NA birth_order_nonlinear2 0.02081 0.03354 0.6204 4919 0.535 -0.04493 0.08655
fixed NA birth_order_nonlinear3 0.07339 0.04148 1.769 5119 0.07687 -0.007901 0.1547
fixed NA birth_order_nonlinear4 0.05819 0.05138 1.132 5267 0.2575 -0.04251 0.1589
fixed NA birth_order_nonlinear5 0.1455 0.06415 2.269 5115 0.02334 0.01979 0.2713
fixed NA birth_order_nonlinear>5 0.09315 0.06484 1.437 5851 0.1509 -0.03393 0.2202
ran_pars mother_pidlink sd__(Intercept) 0.4367 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9232 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.4642 0.4503 -1.031 5845 0.3026 -1.347 0.4183
fixed NA poly(age, 3, raw = TRUE)1 0.1045 0.05104 2.048 5840 0.04057 0.004513 0.2046
fixed NA poly(age, 3, raw = TRUE)2 -0.003813 0.001822 -2.093 5842 0.03643 -0.007384 -0.0002416
fixed NA poly(age, 3, raw = TRUE)3 0.00004129 0.00002065 1.999 5846 0.04563 0.0000008111 0.00008176
fixed NA male -0.1531 0.0262 -5.845 5749 0.000000005357 -0.2044 -0.1018
fixed NA count_birth_order2/2 0.03911 0.06081 0.6432 5211 0.5201 -0.08008 0.1583
fixed NA count_birth_order1/3 0.004539 0.0546 0.08314 5856 0.9337 -0.1025 0.1115
fixed NA count_birth_order2/3 0.02779 0.05938 0.4679 5897 0.6399 -0.0886 0.1442
fixed NA count_birth_order3/3 0.05161 0.06635 0.7778 5909 0.4367 -0.07844 0.1816
fixed NA count_birth_order1/4 -0.1031 0.06635 -1.553 5892 0.1204 -0.2331 0.02698
fixed NA count_birth_order2/4 -0.131 0.06871 -1.907 5909 0.05654 -0.2657 0.003622
fixed NA count_birth_order3/4 -0.03292 0.07245 -0.4543 5902 0.6496 -0.1749 0.1091
fixed NA count_birth_order4/4 -0.02071 0.0754 -0.2747 5900 0.7836 -0.1685 0.1271
fixed NA count_birth_order1/5 -0.1396 0.09008 -1.55 5907 0.1212 -0.3162 0.03694
fixed NA count_birth_order2/5 -0.1104 0.0965 -1.144 5873 0.2527 -0.2995 0.07874
fixed NA count_birth_order3/5 -0.06116 0.09072 -0.6741 5878 0.5003 -0.239 0.1167
fixed NA count_birth_order4/5 -0.2161 0.08761 -2.466 5891 0.01368 -0.3878 -0.04436
fixed NA count_birth_order5/5 -0.08756 0.09067 -0.9657 5878 0.3342 -0.2653 0.09014
fixed NA count_birth_order1/>5 -0.3657 0.08971 -4.076 5887 0.00004633 -0.5415 -0.1899
fixed NA count_birth_order2/>5 -0.3071 0.08873 -3.461 5871 0.0005426 -0.481 -0.1332
fixed NA count_birth_order3/>5 -0.2507 0.08883 -2.822 5838 0.004793 -0.4248 -0.07655
fixed NA count_birth_order4/>5 -0.2177 0.0835 -2.607 5839 0.009165 -0.3813 -0.05401
fixed NA count_birth_order5/>5 -0.1333 0.07903 -1.687 5845 0.09166 -0.2882 0.02158
fixed NA count_birth_order>5/>5 -0.2173 0.06012 -3.614 5535 0.0003043 -0.3351 -0.09944
ran_pars mother_pidlink sd__(Intercept) 0.4363 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9239 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 17008 17082 -8493 16986 NA NA NA
12 17007 17087 -8492 16983 3.304 1 0.06913
16 17012 17119 -8490 16980 3.482 4 0.4806
26 17027 17200 -8487 16975 4.996 10 0.8914

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3743 0.4477 -0.8361 5896 0.4031 -1.252 0.5032
fixed NA poly(age, 3, raw = TRUE)1 0.09573 0.05083 1.883 5896 0.05971 -0.003898 0.1954
fixed NA poly(age, 3, raw = TRUE)2 -0.003491 0.001815 -1.924 5899 0.05445 -0.007049 0.00006595
fixed NA poly(age, 3, raw = TRUE)3 0.00003683 0.00002057 1.791 5904 0.0734 -0.000003482 0.00007714
fixed NA male -0.1544 0.02611 -5.913 5811 0.000000003555 -0.2056 -0.1032
fixed NA sibling_count3 0.02706 0.04542 0.5958 4569 0.5513 -0.06196 0.1161
fixed NA sibling_count4 -0.07306 0.04794 -1.524 4212 0.1276 -0.167 0.0209
fixed NA sibling_count5 -0.08228 0.05143 -1.6 3875 0.1097 -0.1831 0.01851
fixed NA sibling_count>5 -0.1821 0.04509 -4.039 4006 0.00005475 -0.2705 -0.09372
ran_pars mother_pidlink sd__(Intercept) 0.4413 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.924 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3791 0.4478 -0.8465 5894 0.3973 -1.257 0.4986
fixed NA birth_order 0.004275 0.007636 0.5599 5883 0.5756 -0.01069 0.01924
fixed NA poly(age, 3, raw = TRUE)1 0.09565 0.05084 1.882 5895 0.05994 -0.003984 0.1953
fixed NA poly(age, 3, raw = TRUE)2 -0.003495 0.001815 -1.926 5897 0.05421 -0.007052 0.00006254
fixed NA poly(age, 3, raw = TRUE)3 0.00003704 0.00002057 1.801 5902 0.07182 -0.000003279 0.00007736
fixed NA male -0.1546 0.02611 -5.919 5811 0.000000003432 -0.2057 -0.1034
fixed NA sibling_count3 0.02495 0.04558 0.5475 4569 0.5841 -0.06438 0.1143
fixed NA sibling_count4 -0.07783 0.04869 -1.598 4210 0.11 -0.1733 0.0176
fixed NA sibling_count5 -0.08982 0.05317 -1.689 3906 0.0912 -0.194 0.01438
fixed NA sibling_count>5 -0.1979 0.05319 -3.721 4325 0.0002013 -0.3021 -0.09364
ran_pars mother_pidlink sd__(Intercept) 0.4415 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.924 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3883 0.4486 -0.8654 5902 0.3868 -1.268 0.491
fixed NA poly(age, 3, raw = TRUE)1 0.09661 0.05088 1.899 5897 0.05764 -0.003112 0.1963
fixed NA poly(age, 3, raw = TRUE)2 -0.003535 0.001817 -1.946 5899 0.05174 -0.007096 0.00002593
fixed NA poly(age, 3, raw = TRUE)3 0.00003765 0.00002059 1.828 5903 0.06754 -0.000002709 0.00007801
fixed NA male -0.1548 0.02612 -5.928 5806 0.000000003245 -0.206 -0.1036
fixed NA sibling_count3 0.01383 0.04637 0.2983 4713 0.7655 -0.07706 0.1047
fixed NA sibling_count4 -0.09552 0.05032 -1.898 4474 0.05772 -0.1942 0.003102
fixed NA sibling_count5 -0.1103 0.05558 -1.984 4271 0.04728 -0.2192 -0.001355
fixed NA sibling_count>5 -0.2216 0.05474 -4.048 4571 0.00005241 -0.3289 -0.1143
fixed NA birth_order_nonlinear2 0.02009 0.03426 0.5864 5042 0.5576 -0.04706 0.08725
fixed NA birth_order_nonlinear3 0.05782 0.04142 1.396 5231 0.1628 -0.02337 0.139
fixed NA birth_order_nonlinear4 0.05083 0.04996 1.018 5390 0.3089 -0.04708 0.1488
fixed NA birth_order_nonlinear5 0.0438 0.06117 0.716 5309 0.474 -0.07609 0.1637
fixed NA birth_order_nonlinear>5 0.05985 0.05819 1.029 5960 0.3037 -0.05419 0.1739
ran_pars mother_pidlink sd__(Intercept) 0.4413 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9242 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.4364 0.4495 -0.9708 5896 0.3317 -1.317 0.4447
fixed NA poly(age, 3, raw = TRUE)1 0.1003 0.05096 1.969 5888 0.04902 0.0004537 0.2002
fixed NA poly(age, 3, raw = TRUE)2 -0.003676 0.00182 -2.02 5890 0.04343 -0.007243 -0.0001092
fixed NA poly(age, 3, raw = TRUE)3 0.00003931 0.00002063 1.906 5895 0.05675 -0.000001122 0.00007975
fixed NA male -0.1557 0.02614 -5.956 5795 0.00000000273 -0.2069 -0.1044
fixed NA count_birth_order2/2 0.07481 0.06677 1.12 5335 0.2626 -0.05605 0.2057
fixed NA count_birth_order1/3 0.06574 0.05921 1.11 5908 0.267 -0.05032 0.1818
fixed NA count_birth_order2/3 0.007638 0.06399 0.1194 5947 0.905 -0.1178 0.1331
fixed NA count_birth_order3/3 0.08768 0.07201 1.218 5962 0.2234 -0.05346 0.2288
fixed NA count_birth_order1/4 -0.1036 0.06955 -1.49 5943 0.1363 -0.24 0.03269
fixed NA count_birth_order2/4 -0.03628 0.07118 -0.5097 5960 0.6103 -0.1758 0.1032
fixed NA count_birth_order3/4 -0.02561 0.07771 -0.3295 5954 0.7418 -0.1779 0.1267
fixed NA count_birth_order4/4 -0.006286 0.08024 -0.07833 5955 0.9376 -0.1636 0.151
fixed NA count_birth_order1/5 -0.007333 0.08258 -0.0888 5961 0.9292 -0.1692 0.1545
fixed NA count_birth_order2/5 -0.07043 0.08902 -0.7912 5943 0.4288 -0.2449 0.104
fixed NA count_birth_order3/5 0.01048 0.08637 0.1213 5944 0.9034 -0.1588 0.1798
fixed NA count_birth_order4/5 -0.1567 0.08947 -1.752 5929 0.07989 -0.3321 0.01864
fixed NA count_birth_order5/5 -0.09262 0.08928 -1.037 5933 0.2996 -0.2676 0.08236
fixed NA count_birth_order1/>5 -0.2681 0.07886 -3.399 5962 0.00068 -0.4226 -0.1135
fixed NA count_birth_order2/>5 -0.1808 0.0821 -2.202 5938 0.02769 -0.3417 -0.01989
fixed NA count_birth_order3/>5 -0.1727 0.08036 -2.149 5926 0.03167 -0.3302 -0.0152
fixed NA count_birth_order4/>5 -0.09252 0.0776 -1.192 5925 0.2332 -0.2446 0.05957
fixed NA count_birth_order5/>5 -0.128 0.07952 -1.61 5885 0.1075 -0.2839 0.02784
fixed NA count_birth_order>5/>5 -0.1425 0.05907 -2.413 5628 0.01584 -0.2583 -0.02678
ran_pars mother_pidlink sd__(Intercept) 0.4412 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9243 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 17187 17261 -8583 17165 NA NA NA
12 17189 17269 -8582 17165 0.3133 1 0.5757
16 17195 17302 -8581 17163 2.203 4 0.6986
26 17205 17379 -8577 17153 9.439 10 0.491

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5356 0.4544 -1.179 5726 0.2386 -1.426 0.355
fixed NA poly(age, 3, raw = TRUE)1 0.1138 0.05159 2.206 5726 0.0274 0.01271 0.215
fixed NA poly(age, 3, raw = TRUE)2 -0.004171 0.001842 -2.264 5728 0.02359 -0.007782 -0.0005606
fixed NA poly(age, 3, raw = TRUE)3 0.00004509 0.00002088 2.16 5733 0.03084 0.000004169 0.00008602
fixed NA male -0.1506 0.02649 -5.685 5646 0.0000000137 -0.2025 -0.09867
fixed NA sibling_count3 0.01379 0.04149 0.3323 4340 0.7397 -0.06754 0.09511
fixed NA sibling_count4 -0.06312 0.04509 -1.4 3922 0.1616 -0.1515 0.02524
fixed NA sibling_count5 -0.1219 0.05343 -2.282 3498 0.02258 -0.2266 -0.01718
fixed NA sibling_count>5 -0.2157 0.04628 -4.662 3343 0.00000326 -0.3064 -0.125
ran_pars mother_pidlink sd__(Intercept) 0.4422 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9234 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5462 0.4544 -1.202 5725 0.2294 -1.437 0.3443
fixed NA birth_order 0.01591 0.008989 1.77 5803 0.07671 -0.001704 0.03353
fixed NA poly(age, 3, raw = TRUE)1 0.1127 0.05159 2.185 5726 0.0289 0.01163 0.2138
fixed NA poly(age, 3, raw = TRUE)2 -0.004158 0.001842 -2.258 5727 0.02401 -0.007768 -0.0005481
fixed NA poly(age, 3, raw = TRUE)3 0.0000456 0.00002088 2.184 5731 0.02902 0.000004674 0.00008652
fixed NA male -0.151 0.02648 -5.703 5645 0.00000001235 -0.2029 -0.09913
fixed NA sibling_count3 0.005873 0.04173 0.1408 4346 0.8881 -0.07591 0.08765
fixed NA sibling_count4 -0.08142 0.04625 -1.76 3953 0.0784 -0.1721 0.009226
fixed NA sibling_count5 -0.1509 0.05588 -2.701 3591 0.006953 -0.2604 -0.04139
fixed NA sibling_count>5 -0.2759 0.0574 -4.806 3956 0.000001597 -0.3884 -0.1634
ran_pars mother_pidlink sd__(Intercept) 0.4423 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9231 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5386 0.4552 -1.183 5733 0.2368 -1.431 0.3536
fixed NA poly(age, 3, raw = TRUE)1 0.1138 0.05163 2.205 5729 0.02753 0.01263 0.215
fixed NA poly(age, 3, raw = TRUE)2 -0.004199 0.001843 -2.278 5729 0.02276 -0.007812 -0.0005865
fixed NA poly(age, 3, raw = TRUE)3 0.00004613 0.0000209 2.207 5731 0.02733 0.000005169 0.00008709
fixed NA male -0.1512 0.02649 -5.709 5640 0.00000001192 -0.2032 -0.09932
fixed NA sibling_count3 -0.002021 0.04257 -0.04749 4520 0.9621 -0.08546 0.08141
fixed NA sibling_count4 -0.09644 0.04802 -2.008 4255 0.0447 -0.1906 -0.002312
fixed NA sibling_count5 -0.1759 0.0583 -3.017 3950 0.002569 -0.2901 -0.06163
fixed NA sibling_count>5 -0.2909 0.05907 -4.924 4212 0.0000008797 -0.4067 -0.1751
fixed NA birth_order_nonlinear2 0.01337 0.03353 0.3987 4805 0.6901 -0.05235 0.07909
fixed NA birth_order_nonlinear3 0.06506 0.04154 1.566 4981 0.1174 -0.01636 0.1465
fixed NA birth_order_nonlinear4 0.08177 0.05293 1.545 5123 0.1225 -0.02197 0.1855
fixed NA birth_order_nonlinear5 0.1201 0.06705 1.791 4995 0.07334 -0.01132 0.2515
fixed NA birth_order_nonlinear>5 0.09651 0.06699 1.441 5696 0.1497 -0.03479 0.2278
ran_pars mother_pidlink sd__(Intercept) 0.4415 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9236 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5806 0.4565 -1.272 5727 0.2035 -1.475 0.3142
fixed NA poly(age, 3, raw = TRUE)1 0.1187 0.05177 2.292 5721 0.02193 0.0172 0.2201
fixed NA poly(age, 3, raw = TRUE)2 -0.004378 0.001849 -2.368 5722 0.0179 -0.008002 -0.0007549
fixed NA poly(age, 3, raw = TRUE)3 0.00004819 0.00002096 2.299 5725 0.02154 0.000007106 0.00008928
fixed NA male -0.15 0.02652 -5.658 5629 0.00000001609 -0.202 -0.09806
fixed NA count_birth_order2/2 0.01536 0.05925 0.2592 5053 0.7955 -0.1008 0.1315
fixed NA count_birth_order1/3 0.003387 0.05402 0.0627 5738 0.95 -0.1025 0.1093
fixed NA count_birth_order2/3 0.008751 0.05945 0.1472 5784 0.883 -0.1078 0.1253
fixed NA count_birth_order3/3 0.05884 0.06529 0.9012 5790 0.3675 -0.06912 0.1868
fixed NA count_birth_order1/4 -0.09925 0.06679 -1.486 5780 0.1373 -0.2302 0.03165
fixed NA count_birth_order2/4 -0.123 0.06896 -1.783 5790 0.07458 -0.2581 0.01218
fixed NA count_birth_order3/4 0.001164 0.07194 0.01618 5781 0.9871 -0.1398 0.1422
fixed NA count_birth_order4/4 0.008341 0.07586 0.11 5773 0.9125 -0.1403 0.157
fixed NA count_birth_order1/5 -0.123 0.09033 -1.361 5790 0.1735 -0.3 0.05408
fixed NA count_birth_order2/5 -0.0875 0.0999 -0.8758 5745 0.3812 -0.2833 0.1083
fixed NA count_birth_order3/5 -0.0931 0.09501 -0.9799 5751 0.3272 -0.2793 0.09312
fixed NA count_birth_order4/5 -0.1781 0.09211 -1.934 5767 0.05316 -0.3587 0.002391
fixed NA count_birth_order5/5 -0.11 0.09724 -1.131 5751 0.2581 -0.3006 0.08061
fixed NA count_birth_order1/>5 -0.3524 0.09201 -3.83 5761 0.0001293 -0.5328 -0.1721
fixed NA count_birth_order2/>5 -0.2463 0.09116 -2.702 5745 0.006907 -0.425 -0.06767
fixed NA count_birth_order3/>5 -0.2817 0.09003 -3.129 5714 0.001761 -0.4582 -0.1053
fixed NA count_birth_order4/>5 -0.1651 0.08801 -1.876 5683 0.06067 -0.3376 0.007367
fixed NA count_birth_order5/>5 -0.1366 0.08107 -1.685 5715 0.09204 -0.2955 0.02229
fixed NA count_birth_order>5/>5 -0.1927 0.06138 -3.139 5405 0.001704 -0.313 -0.07237
ran_pars mother_pidlink sd__(Intercept) 0.4406 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9244 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16690 16763 -8334 16668 NA NA NA
12 16689 16769 -8332 16665 3.138 1 0.07648
16 16695 16801 -8331 16663 2.443 4 0.6549
26 16709 16882 -8329 16657 5.429 10 0.8607

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Raven 2015 young

birthorder <- birthorder %>% mutate(outcome = raven_2015_young)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.913 0.1161 -25.09 11555 2.58e-135 -3.141 -2.686
fixed NA poly(age, 3, raw = TRUE)1 0.4204 0.02155 19.5 11680 2.191e-83 0.3781 0.4626
fixed NA poly(age, 3, raw = TRUE)2 -0.01677 0.00125 -13.41 11811 1.002e-40 -0.01922 -0.01432
fixed NA poly(age, 3, raw = TRUE)3 0.000206 0.00002297 8.97 11829 3.408e-19 0.000161 0.0002511
fixed NA male 0.04925 0.01654 2.977 11006 0.002914 0.01683 0.08168
fixed NA sibling_count3 -0.03514 0.02866 -1.226 7714 0.2202 -0.09131 0.02103
fixed NA sibling_count4 -0.08887 0.03214 -2.765 7047 0.005701 -0.1519 -0.02588
fixed NA sibling_count5 -0.07689 0.03636 -2.115 6427 0.03447 -0.1482 -0.005637
fixed NA sibling_count>5 -0.244 0.02882 -8.467 7187 3.014e-17 -0.3005 -0.1875
ran_pars mother_pidlink sd__(Intercept) 0.5099 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.786 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.899 0.1165 -24.88 11582 3.297e-133 -3.127 -2.671
fixed NA birth_order -0.006508 0.004435 -1.467 9943 0.1423 -0.0152 0.002184
fixed NA poly(age, 3, raw = TRUE)1 0.4199 0.02156 19.48 11679 3.334e-83 0.3777 0.4622
fixed NA poly(age, 3, raw = TRUE)2 -0.01677 0.00125 -13.41 11810 1.04e-40 -0.01922 -0.01432
fixed NA poly(age, 3, raw = TRUE)3 0.0002058 0.00002297 8.96 11828 3.716e-19 0.0001608 0.0002508
fixed NA male 0.04936 0.01654 2.984 11007 0.002855 0.01693 0.08178
fixed NA sibling_count3 -0.03129 0.02878 -1.087 7689 0.2769 -0.08769 0.02511
fixed NA sibling_count4 -0.07961 0.03275 -2.431 6933 0.01508 -0.1438 -0.01543
fixed NA sibling_count5 -0.06196 0.03775 -1.641 6268 0.1007 -0.1359 0.01202
fixed NA sibling_count>5 -0.2073 0.03816 -5.432 6679 0.0000000577 -0.2821 -0.1325
ran_pars mother_pidlink sd__(Intercept) 0.5097 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7861 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.907 0.1177 -24.7 11650 2.209e-131 -3.137 -2.676
fixed NA poly(age, 3, raw = TRUE)1 0.4201 0.02164 19.42 11706 1.131e-82 0.3777 0.4625
fixed NA poly(age, 3, raw = TRUE)2 -0.01679 0.001252 -13.41 11810 1.118e-40 -0.01924 -0.01433
fixed NA poly(age, 3, raw = TRUE)3 0.0002063 0.00002299 8.976 11824 3.216e-19 0.0001613 0.0002514
fixed NA male 0.04912 0.01655 2.969 11003 0.002995 0.01669 0.08155
fixed NA sibling_count3 -0.03626 0.02964 -1.223 8172 0.2213 -0.09435 0.02184
fixed NA sibling_count4 -0.08243 0.03527 -2.337 7997 0.01945 -0.1515 -0.01331
fixed NA sibling_count5 -0.05136 0.04155 -1.236 7548 0.2164 -0.1328 0.03007
fixed NA sibling_count>5 -0.1992 0.04201 -4.74 8504 0.000002171 -0.2815 -0.1168
fixed NA birth_order_nonlinear2 -0.0004814 0.02252 -0.02137 9154 0.983 -0.04463 0.04367
fixed NA birth_order_nonlinear3 0.007394 0.02843 0.2601 9816 0.7948 -0.04832 0.06311
fixed NA birth_order_nonlinear4 -0.02942 0.03523 -0.835 10040 0.4037 -0.09847 0.03963
fixed NA birth_order_nonlinear5 -0.06717 0.04142 -1.622 10362 0.1049 -0.1484 0.01401
fixed NA birth_order_nonlinear>5 -0.05048 0.03943 -1.28 11825 0.2005 -0.1278 0.02681
ran_pars mother_pidlink sd__(Intercept) 0.51 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.786 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.913 0.1186 -24.56 11674 7.1e-130 -3.146 -2.681
fixed NA poly(age, 3, raw = TRUE)1 0.4217 0.02167 19.46 11712 5.229e-83 0.3792 0.4642
fixed NA poly(age, 3, raw = TRUE)2 -0.01689 0.001254 -13.47 11803 4.996e-41 -0.01934 -0.01443
fixed NA poly(age, 3, raw = TRUE)3 0.000208 0.00002301 9.043 11813 1.755e-19 0.000163 0.0002531
fixed NA male 0.04874 0.01655 2.945 10994 0.003232 0.01631 0.08117
fixed NA count_birth_order2/2 -0.004616 0.0367 -0.1258 9686 0.8999 -0.07655 0.06732
fixed NA count_birth_order1/3 -0.06756 0.03753 -1.8 11550 0.07182 -0.1411 0.005986
fixed NA count_birth_order2/3 -0.03873 0.03826 -1.012 11657 0.3115 -0.1137 0.03627
fixed NA count_birth_order3/3 0.02046 0.04332 0.4722 11790 0.6368 -0.06446 0.1054
fixed NA count_birth_order1/4 -0.06759 0.05129 -1.318 11816 0.1876 -0.1681 0.03294
fixed NA count_birth_order2/4 -0.04354 0.04874 -0.8935 11815 0.3716 -0.1391 0.05198
fixed NA count_birth_order3/4 -0.1544 0.04591 -3.362 11784 0.0007749 -0.2444 -0.06439
fixed NA count_birth_order4/4 -0.07384 0.05012 -1.473 11817 0.1406 -0.1721 0.02438
fixed NA count_birth_order1/5 0.0104 0.0696 0.1495 11533 0.8812 -0.126 0.1468
fixed NA count_birth_order2/5 -0.08665 0.06625 -1.308 11634 0.1909 -0.2165 0.0432
fixed NA count_birth_order3/5 -0.01868 0.06002 -0.3112 11768 0.7557 -0.1363 0.09896
fixed NA count_birth_order4/5 -0.1326 0.05643 -2.35 11815 0.01879 -0.2432 -0.02201
fixed NA count_birth_order5/5 -0.1062 0.05597 -1.897 11816 0.05781 -0.2159 0.003508
fixed NA count_birth_order1/>5 -0.1548 0.0697 -2.221 11101 0.0264 -0.2914 -0.01816
fixed NA count_birth_order2/>5 -0.2376 0.06527 -3.64 11201 0.000274 -0.3655 -0.1096
fixed NA count_birth_order3/>5 -0.1763 0.0581 -3.035 11506 0.002412 -0.2902 -0.06244
fixed NA count_birth_order4/>5 -0.2312 0.05287 -4.372 11629 0.0000124 -0.3348 -0.1275
fixed NA count_birth_order5/>5 -0.2756 0.0475 -5.802 11774 0.00000000672 -0.3687 -0.1825
fixed NA count_birth_order>5/>5 -0.2508 0.03316 -7.564 10427 4.239e-14 -0.3158 -0.1858
ran_pars mother_pidlink sd__(Intercept) 0.5098 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7859 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 31548 31629 -15763 31526 NA NA NA
12 31548 31636 -15762 31524 2.156 1 0.142
16 31554 31672 -15761 31522 2.168 4 0.705
26 31560 31752 -15754 31508 14.05 10 0.1707

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.135 0.1776 -17.65 6969 3.073e-68 -3.483 -2.787
fixed NA poly(age, 3, raw = TRUE)1 0.4673 0.03646 12.82 6899 3.477e-37 0.3958 0.5388
fixed NA poly(age, 3, raw = TRUE)2 -0.01963 0.00231 -8.494 6902 2.413e-17 -0.02415 -0.0151
fixed NA poly(age, 3, raw = TRUE)3 0.0002649 0.0000455 5.821 6905 0.000000006115 0.0001757 0.0003541
fixed NA male 0.03061 0.01923 1.592 7906 0.1115 -0.007084 0.06831
fixed NA sibling_count3 -0.05946 0.02726 -2.182 5246 0.02919 -0.1129 -0.00604
fixed NA sibling_count4 -0.1194 0.03344 -3.571 4564 0.0003592 -0.185 -0.05388
fixed NA sibling_count5 -0.2169 0.04292 -5.054 4129 0.0000004515 -0.301 -0.1328
fixed NA sibling_count>5 -0.2597 0.03991 -6.508 4298 0.00000000008506 -0.338 -0.1815
ran_pars mother_pidlink sd__(Intercept) 0.4912 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7717 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.103 0.1799 -17.25 7201 2.301e-65 -3.456 -2.751
fixed NA birth_order -0.009805 0.008629 -1.136 8264 0.2559 -0.02672 0.007108
fixed NA poly(age, 3, raw = TRUE)1 0.4643 0.03656 12.7 6958 1.483e-36 0.3927 0.536
fixed NA poly(age, 3, raw = TRUE)2 -0.01948 0.002314 -8.417 6927 4.631e-17 -0.02401 -0.01494
fixed NA poly(age, 3, raw = TRUE)3 0.0002623 0.00004557 5.756 6926 0.000000008997 0.000173 0.0003516
fixed NA male 0.0307 0.01923 1.596 7907 0.1105 -0.006995 0.0684
fixed NA sibling_count3 -0.05286 0.02786 -1.897 5212 0.05782 -0.1075 0.001741
fixed NA sibling_count4 -0.1048 0.03583 -2.924 4584 0.003471 -0.175 -0.03455
fixed NA sibling_count5 -0.1926 0.04793 -4.018 4318 0.0000596 -0.2865 -0.09866
fixed NA sibling_count>5 -0.2124 0.05769 -3.682 5150 0.0002337 -0.3255 -0.09936
ran_pars mother_pidlink sd__(Intercept) 0.4907 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7719 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.137 0.1795 -17.48 7152 5.132e-67 -3.488 -2.785
fixed NA poly(age, 3, raw = TRUE)1 0.4676 0.03657 12.79 6956 5.175e-37 0.3959 0.5393
fixed NA poly(age, 3, raw = TRUE)2 -0.01965 0.002314 -8.493 6918 2.445e-17 -0.02419 -0.01512
fixed NA poly(age, 3, raw = TRUE)3 0.0002655 0.00004556 5.826 6921 0.000000005938 0.0001761 0.0003548
fixed NA male 0.02997 0.01924 1.558 7903 0.1193 -0.007733 0.06767
fixed NA sibling_count3 -0.0652 0.02908 -2.242 5705 0.02498 -0.1222 -0.008209
fixed NA sibling_count4 -0.1234 0.03863 -3.194 5346 0.001412 -0.1991 -0.04767
fixed NA sibling_count5 -0.1819 0.05257 -3.459 5238 0.0005461 -0.2849 -0.07882
fixed NA sibling_count>5 -0.2346 0.06227 -3.768 5989 0.0001662 -0.3567 -0.1126
fixed NA birth_order_nonlinear2 0.0033 0.02304 0.1432 6116 0.8861 -0.04186 0.04846
fixed NA birth_order_nonlinear3 0.0203 0.03226 0.6294 7022 0.5291 -0.04292 0.08353
fixed NA birth_order_nonlinear4 -0.002993 0.04418 -0.06775 7409 0.946 -0.08958 0.08359
fixed NA birth_order_nonlinear5 -0.1088 0.05943 -1.831 7381 0.06711 -0.2253 0.00765
fixed NA birth_order_nonlinear>5 -0.01069 0.06881 -0.1554 8447 0.8765 -0.1456 0.1242
ran_pars mother_pidlink sd__(Intercept) 0.4915 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7716 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.146 0.1802 -17.46 7170 7.311e-67 -3.499 -2.793
fixed NA poly(age, 3, raw = TRUE)1 0.4697 0.03664 12.82 6956 3.382e-37 0.3979 0.5415
fixed NA poly(age, 3, raw = TRUE)2 -0.01981 0.002319 -8.545 6912 1.564e-17 -0.02436 -0.01527
fixed NA poly(age, 3, raw = TRUE)3 0.000269 0.00004566 5.891 6911 0.00000000402 0.0001795 0.0003585
fixed NA male 0.03042 0.01924 1.581 7884 0.1139 -0.007291 0.06813
fixed NA count_birth_order2/2 0.006774 0.03232 0.2096 6664 0.834 -0.05657 0.07011
fixed NA count_birth_order1/3 -0.08009 0.038 -2.108 8391 0.0351 -0.1546 -0.00561
fixed NA count_birth_order2/3 -0.07185 0.03655 -1.966 8401 0.04936 -0.1435 -0.0002115
fixed NA count_birth_order3/3 -0.01001 0.04001 -0.2501 8438 0.8025 -0.08843 0.06842
fixed NA count_birth_order1/4 -0.04987 0.05992 -0.8323 8326 0.4052 -0.1673 0.06757
fixed NA count_birth_order2/4 -0.09864 0.05259 -1.876 8435 0.06075 -0.2017 0.00444
fixed NA count_birth_order3/4 -0.1871 0.05021 -3.726 8436 0.0001958 -0.2855 -0.08867
fixed NA count_birth_order4/4 -0.1056 0.04973 -2.124 8446 0.03372 -0.2031 -0.008146
fixed NA count_birth_order1/5 -0.2007 0.1043 -1.924 7369 0.05443 -0.4053 0.003786
fixed NA count_birth_order2/5 -0.146 0.09299 -1.57 7769 0.1164 -0.3283 0.03624
fixed NA count_birth_order3/5 -0.08258 0.07873 -1.049 8171 0.2943 -0.2369 0.07173
fixed NA count_birth_order4/5 -0.2497 0.06518 -3.83 8440 0.0001288 -0.3774 -0.1219
fixed NA count_birth_order5/5 -0.2776 0.06325 -4.388 8446 0.00001155 -0.4016 -0.1536
fixed NA count_birth_order1/>5 -0.268 0.1333 -2.01 6843 0.04445 -0.5293 -0.006699
fixed NA count_birth_order2/>5 -0.262 0.122 -2.148 6913 0.03172 -0.5011 -0.02298
fixed NA count_birth_order3/>5 -0.2095 0.1009 -2.077 7561 0.03784 -0.4072 -0.0118
fixed NA count_birth_order4/>5 -0.179 0.09054 -1.977 7764 0.04811 -0.3564 -0.001516
fixed NA count_birth_order5/>5 -0.359 0.07278 -4.933 8225 0.0000008267 -0.5016 -0.2164
fixed NA count_birth_order>5/>5 -0.244 0.04847 -5.033 7297 0.0000004942 -0.339 -0.149
ran_pars mother_pidlink sd__(Intercept) 0.4921 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7711 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 22246 22323 -11112 22224 NA NA NA
12 22246 22331 -11111 22222 1.293 1 0.2554
16 22250 22363 -11109 22218 4.165 4 0.3842
26 22259 22442 -11103 22207 11.6 10 0.3129

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.141 0.177 -17.75 7058 5.705e-69 -3.488 -2.794
fixed NA poly(age, 3, raw = TRUE)1 0.4677 0.03633 12.87 6968 1.719e-37 0.3965 0.5389
fixed NA poly(age, 3, raw = TRUE)2 -0.01973 0.002303 -8.564 6967 1.324e-17 -0.02424 -0.01521
fixed NA poly(age, 3, raw = TRUE)3 0.0002666 0.00004538 5.876 6968 0.000000004403 0.0001777 0.0003556
fixed NA male 0.02784 0.01915 1.454 7992 0.1461 -0.009698 0.06538
fixed NA sibling_count3 -0.04184 0.0286 -1.463 5531 0.1435 -0.09789 0.0142
fixed NA sibling_count4 -0.07294 0.03364 -2.168 4993 0.03018 -0.1389 -0.007009
fixed NA sibling_count5 -0.08591 0.03944 -2.178 4612 0.02944 -0.1632 -0.008609
fixed NA sibling_count>5 -0.1944 0.03514 -5.532 4639 0.00000003339 -0.2633 -0.1255
ran_pars mother_pidlink sd__(Intercept) 0.4946 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7717 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.082 0.1787 -17.25 7233 2.258e-65 -3.432 -2.732
fixed NA birth_order -0.0174 0.007239 -2.404 8279 0.01625 -0.03159 -0.003213
fixed NA poly(age, 3, raw = TRUE)1 0.4622 0.0364 12.7 7010 1.553e-36 0.3908 0.5335
fixed NA poly(age, 3, raw = TRUE)2 -0.01947 0.002306 -8.443 6984 3.712e-17 -0.02399 -0.01495
fixed NA poly(age, 3, raw = TRUE)3 0.0002621 0.00004541 5.772 6983 0.000000008185 0.0001731 0.0003511
fixed NA male 0.02841 0.01915 1.484 7995 0.1379 -0.009121 0.06595
fixed NA sibling_count3 -0.03073 0.02895 -1.062 5517 0.2884 -0.08747 0.02601
fixed NA sibling_count4 -0.04801 0.03518 -1.364 4998 0.1725 -0.117 0.02095
fixed NA sibling_count5 -0.04672 0.04264 -1.096 4706 0.2733 -0.1303 0.03686
fixed NA sibling_count>5 -0.1149 0.04825 -2.381 5317 0.01728 -0.2095 -0.02034
ran_pars mother_pidlink sd__(Intercept) 0.4935 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.772 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.112 0.1786 -17.42 7207 1.296e-66 -3.462 -2.762
fixed NA poly(age, 3, raw = TRUE)1 0.4643 0.03643 12.75 7008 8.484e-37 0.3929 0.5357
fixed NA poly(age, 3, raw = TRUE)2 -0.01959 0.002306 -8.495 6975 2.4e-17 -0.02411 -0.01507
fixed NA poly(age, 3, raw = TRUE)3 0.0002645 0.00004542 5.823 6976 0.000000006049 0.0001754 0.0003535
fixed NA male 0.0276 0.01915 1.441 7990 0.1496 -0.009942 0.06514
fixed NA sibling_count3 -0.03796 0.0301 -1.261 5961 0.2073 -0.09696 0.02103
fixed NA sibling_count4 -0.05896 0.03796 -1.553 5744 0.1204 -0.1334 0.01543
fixed NA sibling_count5 -0.03642 0.0465 -0.7831 5574 0.4336 -0.1276 0.05473
fixed NA sibling_count>5 -0.1248 0.05121 -2.436 6161 0.01487 -0.2251 -0.02438
fixed NA birth_order_nonlinear2 -0.01198 0.02373 -0.5048 6214 0.6137 -0.05848 0.03453
fixed NA birth_order_nonlinear3 -0.00978 0.03163 -0.3092 7225 0.7572 -0.07177 0.05221
fixed NA birth_order_nonlinear4 -0.03695 0.04151 -0.8903 7595 0.3734 -0.1183 0.0444
fixed NA birth_order_nonlinear5 -0.132 0.05216 -2.532 7529 0.01138 -0.2343 -0.02981
fixed NA birth_order_nonlinear>5 -0.08421 0.05662 -1.487 8540 0.137 -0.1952 0.02676
ran_pars mother_pidlink sd__(Intercept) 0.4944 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7717 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.121 0.1796 -17.38 7231 2.423e-66 -3.473 -2.769
fixed NA poly(age, 3, raw = TRUE)1 0.467 0.03649 12.8 7014 4.397e-37 0.3955 0.5385
fixed NA poly(age, 3, raw = TRUE)2 -0.0198 0.00231 -8.57 6970 1.262e-17 -0.02433 -0.01527
fixed NA poly(age, 3, raw = TRUE)3 0.000269 0.00004549 5.914 6965 0.000000003502 0.0001799 0.0003582
fixed NA male 0.02854 0.01916 1.489 7974 0.1364 -0.009018 0.0661
fixed NA count_birth_order2/2 -0.01543 0.03533 -0.4366 6716 0.6624 -0.08468 0.05382
fixed NA count_birth_order1/3 -0.06278 0.03938 -1.594 8494 0.1109 -0.14 0.0144
fixed NA count_birth_order2/3 -0.05192 0.03852 -1.348 8511 0.1777 -0.1274 0.02357
fixed NA count_birth_order3/3 -0.0183 0.04222 -0.4335 8538 0.6647 -0.101 0.06445
fixed NA count_birth_order1/4 -0.05623 0.05864 -0.9588 8481 0.3377 -0.1712 0.05871
fixed NA count_birth_order2/4 -0.0529 0.05265 -1.005 8530 0.3151 -0.1561 0.0503
fixed NA count_birth_order3/4 -0.1333 0.0504 -2.644 8539 0.008209 -0.2321 -0.03448
fixed NA count_birth_order4/4 -0.05557 0.05097 -1.09 8548 0.2756 -0.1555 0.04433
fixed NA count_birth_order1/5 0.07905 0.08526 0.9271 7943 0.3539 -0.08807 0.2462
fixed NA count_birth_order2/5 -0.03706 0.07632 -0.4856 8242 0.6273 -0.1866 0.1125
fixed NA count_birth_order3/5 -0.03526 0.06854 -0.5144 8385 0.607 -0.1696 0.09908
fixed NA count_birth_order4/5 -0.1447 0.06314 -2.291 8484 0.02196 -0.2684 -0.02093
fixed NA count_birth_order5/5 -0.1711 0.06082 -2.813 8548 0.004927 -0.2903 -0.05186
fixed NA count_birth_order1/>5 -0.1041 0.09126 -1.14 7671 0.2542 -0.2829 0.0748
fixed NA count_birth_order2/>5 -0.2198 0.1014 -2.167 7149 0.03023 -0.4185 -0.02104
fixed NA count_birth_order3/>5 -0.1055 0.07852 -1.344 7935 0.1789 -0.2594 0.04834
fixed NA count_birth_order4/>5 -0.1646 0.07207 -2.283 8091 0.02243 -0.3058 -0.02331
fixed NA count_birth_order5/>5 -0.2587 0.06275 -4.123 8328 0.00003776 -0.3817 -0.1357
fixed NA count_birth_order>5/>5 -0.2101 0.04393 -4.782 7699 0.000001765 -0.2962 -0.124
ran_pars mother_pidlink sd__(Intercept) 0.4947 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7716 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 22545 22623 -11262 22523 NA NA NA
12 22542 22626 -11259 22518 5.783 1 0.01618
16 22548 22661 -11258 22516 1.276 4 0.8654
26 22558 22742 -11253 22506 9.852 10 0.4535

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.112 0.1791 -17.38 6789 3.385e-66 -3.463 -2.761
fixed NA poly(age, 3, raw = TRUE)1 0.4625 0.03675 12.58 6728 6.582e-36 0.3904 0.5345
fixed NA poly(age, 3, raw = TRUE)2 -0.0194 0.002327 -8.337 6734 9.142e-17 -0.02397 -0.01484
fixed NA poly(age, 3, raw = TRUE)3 0.0002614 0.00004581 5.706 6739 0.00000001203 0.0001716 0.0003512
fixed NA male 0.03031 0.01944 1.559 7696 0.1189 -0.007785 0.0684
fixed NA sibling_count3 -0.04685 0.02732 -1.715 5100 0.08647 -0.1004 0.006702
fixed NA sibling_count4 -0.09949 0.0338 -2.944 4416 0.003262 -0.1657 -0.03324
fixed NA sibling_count5 -0.2019 0.04473 -4.514 4008 0.000006538 -0.2896 -0.1143
fixed NA sibling_count>5 -0.2519 0.04129 -6.1 4167 0.000000001156 -0.3328 -0.171
ran_pars mother_pidlink sd__(Intercept) 0.4914 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7689 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.086 0.1816 -17 7021 1.622e-63 -3.442 -2.73
fixed NA birth_order -0.00767 0.008849 -0.8668 8133 0.3861 -0.02501 0.009673
fixed NA poly(age, 3, raw = TRUE)1 0.46 0.03687 12.48 6788 2.442e-35 0.3877 0.5322
fixed NA poly(age, 3, raw = TRUE)2 -0.01928 0.002332 -8.267 6760 1.636e-16 -0.02385 -0.01471
fixed NA poly(age, 3, raw = TRUE)3 0.0002592 0.00004589 5.648 6760 0.00000001688 0.0001692 0.0003491
fixed NA male 0.03038 0.01944 1.563 7697 0.1181 -0.007719 0.06848
fixed NA sibling_count3 -0.04173 0.02795 -1.493 5076 0.1354 -0.09651 0.01304
fixed NA sibling_count4 -0.08812 0.03625 -2.431 4466 0.01511 -0.1592 -0.01706
fixed NA sibling_count5 -0.1833 0.04961 -3.695 4215 0.0002223 -0.2805 -0.08609
fixed NA sibling_count>5 -0.2153 0.05902 -3.649 5066 0.0002662 -0.331 -0.09967
ran_pars mother_pidlink sd__(Intercept) 0.4911 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7691 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.115 0.181 -17.21 6973 5.081e-65 -3.47 -2.76
fixed NA poly(age, 3, raw = TRUE)1 0.4631 0.03688 12.56 6789 9.093e-36 0.3908 0.5354
fixed NA poly(age, 3, raw = TRUE)2 -0.01947 0.002332 -8.347 6757 8.441e-17 -0.02404 -0.0149
fixed NA poly(age, 3, raw = TRUE)3 0.0002629 0.00004589 5.729 6764 0.00000001057 0.000173 0.0003529
fixed NA male 0.03004 0.01944 1.545 7692 0.1223 -0.008058 0.06814
fixed NA sibling_count3 -0.04791 0.02914 -1.644 5555 0.1002 -0.105 0.009209
fixed NA sibling_count4 -0.102 0.03901 -2.615 5218 0.008942 -0.1785 -0.02556
fixed NA sibling_count5 -0.1672 0.05419 -3.085 5048 0.002047 -0.2734 -0.06097
fixed NA sibling_count>5 -0.2479 0.06378 -3.887 5853 0.0001026 -0.3729 -0.1229
fixed NA birth_order_nonlinear2 0.003997 0.02302 0.1737 5944 0.8621 -0.04112 0.04911
fixed NA birth_order_nonlinear3 0.003994 0.03243 0.1232 6780 0.902 -0.05957 0.06756
fixed NA birth_order_nonlinear4 0.006891 0.04507 0.1529 7110 0.8785 -0.08144 0.09523
fixed NA birth_order_nonlinear5 -0.1106 0.06204 -1.782 7190 0.07473 -0.2322 0.01102
fixed NA birth_order_nonlinear>5 0.02731 0.07101 0.3846 8210 0.7005 -0.1119 0.1665
ran_pars mother_pidlink sd__(Intercept) 0.4917 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7688 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.121 0.1818 -17.17 6983 8.982e-65 -3.478 -2.765
fixed NA poly(age, 3, raw = TRUE)1 0.4648 0.03695 12.58 6782 6.807e-36 0.3924 0.5372
fixed NA poly(age, 3, raw = TRUE)2 -0.01959 0.002337 -8.384 6743 6.16e-17 -0.02417 -0.01501
fixed NA poly(age, 3, raw = TRUE)3 0.0002656 0.00004598 5.776 6745 0.000000007998 0.0001754 0.0003557
fixed NA male 0.03075 0.01944 1.582 7672 0.1137 -0.00735 0.06886
fixed NA count_birth_order2/2 0.001768 0.03197 0.0553 6418 0.9559 -0.06088 0.06442
fixed NA count_birth_order1/3 -0.06413 0.03815 -1.681 8172 0.09279 -0.1389 0.01064
fixed NA count_birth_order2/3 -0.05242 0.03664 -1.431 8180 0.1526 -0.1242 0.0194
fixed NA count_birth_order3/3 -0.0167 0.04017 -0.4156 8217 0.6777 -0.09543 0.06203
fixed NA count_birth_order1/4 -0.0457 0.06025 -0.7585 8115 0.4481 -0.1638 0.07239
fixed NA count_birth_order2/4 -0.07186 0.05325 -1.349 8208 0.1772 -0.1762 0.03251
fixed NA count_birth_order3/4 -0.1843 0.05056 -3.645 8213 0.0002691 -0.2834 -0.08519
fixed NA count_birth_order4/4 -0.07292 0.05041 -1.447 8224 0.148 -0.1717 0.02587
fixed NA count_birth_order1/5 -0.1909 0.1042 -1.832 7330 0.06699 -0.3952 0.01334
fixed NA count_birth_order2/5 -0.1379 0.09972 -1.383 7456 0.1667 -0.3334 0.05753
fixed NA count_birth_order3/5 -0.07514 0.0808 -0.9299 8008 0.3524 -0.2335 0.08323
fixed NA count_birth_order4/5 -0.2494 0.06853 -3.639 8214 0.0002757 -0.3837 -0.115
fixed NA count_birth_order5/5 -0.2528 0.06699 -3.774 8224 0.0001619 -0.3841 -0.1215
fixed NA count_birth_order1/>5 -0.2926 0.1343 -2.179 6611 0.02934 -0.5557 -0.02945
fixed NA count_birth_order2/>5 -0.2989 0.1239 -2.412 6839 0.01588 -0.5418 -0.05605
fixed NA count_birth_order3/>5 -0.2104 0.1014 -2.076 7472 0.03795 -0.4091 -0.01174
fixed NA count_birth_order4/>5 -0.1581 0.09617 -1.644 7459 0.1001 -0.3466 0.03035
fixed NA count_birth_order5/>5 -0.3945 0.07643 -5.161 7979 0.0000002513 -0.5443 -0.2447
fixed NA count_birth_order>5/>5 -0.2215 0.05033 -4.401 7128 0.00001093 -0.3202 -0.1229
ran_pars mother_pidlink sd__(Intercept) 0.4926 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7681 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 21616 21693 -10797 21594 NA NA NA
12 21617 21701 -10796 21593 0.753 1 0.3855
16 21620 21732 -10794 21588 4.805 4 0.3079
26 21627 21810 -10788 21575 12.77 10 0.2369

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Numeracy 2015 young

birthorder <- birthorder %>% mutate(outcome = math_2015_young)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.466 0.1215 -20.3 11620 4.621e-90 -2.704 -2.228
fixed NA poly(age, 3, raw = TRUE)1 0.4048 0.02252 17.97 11708 2.803e-71 0.3606 0.4489
fixed NA poly(age, 3, raw = TRUE)2 -0.01815 0.001303 -13.93 11808 8.797e-44 -0.02071 -0.0156
fixed NA poly(age, 3, raw = TRUE)3 0.0002515 0.00002388 10.53 11832 8.169e-26 0.0002047 0.0002983
fixed NA male -0.1617 0.01737 -9.306 11421 1.566e-20 -0.1957 -0.1276
fixed NA sibling_count3 -0.003588 0.02894 -0.124 7959 0.9013 -0.06031 0.05313
fixed NA sibling_count4 -0.08819 0.03232 -2.729 7151 0.00637 -0.1515 -0.02485
fixed NA sibling_count5 -0.04881 0.0364 -1.341 6386 0.18 -0.1202 0.02254
fixed NA sibling_count>5 -0.2076 0.02899 -7.16 7116 8.847e-13 -0.2644 -0.1508
ran_pars mother_pidlink sd__(Intercept) 0.4412 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.857 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.454 0.1219 -20.14 11640 1.067e-88 -2.693 -2.215
fixed NA birth_order -0.00565 0.004521 -1.25 9229 0.2115 -0.01451 0.003212
fixed NA poly(age, 3, raw = TRUE)1 0.4044 0.02252 17.95 11706 4.06e-71 0.3602 0.4485
fixed NA poly(age, 3, raw = TRUE)2 -0.01814 0.001303 -13.93 11806 9.745e-44 -0.0207 -0.01559
fixed NA poly(age, 3, raw = TRUE)3 0.0002512 0.00002388 10.52 11831 9.269e-26 0.0002044 0.000298
fixed NA male -0.1616 0.01737 -9.302 11421 1.629e-20 -0.1956 -0.1275
fixed NA sibling_count3 -0.000338 0.02905 -0.01163 7928 0.9907 -0.05728 0.05661
fixed NA sibling_count4 -0.08042 0.0329 -2.444 7013 0.01454 -0.1449 -0.01593
fixed NA sibling_count5 -0.03629 0.03775 -0.9613 6187 0.3365 -0.1103 0.0377
fixed NA sibling_count>5 -0.1764 0.03825 -4.612 6410 0.00000406 -0.2514 -0.1014
ran_pars mother_pidlink sd__(Intercept) 0.4408 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8571 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.481 0.1229 -20.18 11694 5.025e-89 -2.722 -2.24
fixed NA poly(age, 3, raw = TRUE)1 0.4066 0.02259 18 11728 1.712e-71 0.3624 0.4509
fixed NA poly(age, 3, raw = TRUE)2 -0.01824 0.001304 -13.98 11807 4.62e-44 -0.02079 -0.01568
fixed NA poly(age, 3, raw = TRUE)3 0.0002523 0.00002389 10.56 11827 5.96e-26 0.0002055 0.0002992
fixed NA male -0.1618 0.01737 -9.315 11416 1.447e-20 -0.1959 -0.1278
fixed NA sibling_count3 -0.01878 0.03001 -0.6259 8433 0.5314 -0.07759 0.04003
fixed NA sibling_count4 -0.09841 0.03565 -2.76 8109 0.005791 -0.1683 -0.02853
fixed NA sibling_count5 -0.04989 0.04188 -1.191 7489 0.2335 -0.132 0.03219
fixed NA sibling_count>5 -0.1826 0.04255 -4.29 8265 0.00001806 -0.266 -0.09916
fixed NA birth_order_nonlinear2 0.01111 0.02393 0.4642 9512 0.6425 -0.03579 0.058
fixed NA birth_order_nonlinear3 0.06162 0.03008 2.048 10195 0.04056 0.002657 0.1206
fixed NA birth_order_nonlinear4 -0.02853 0.03724 -0.7662 10438 0.4436 -0.1015 0.04445
fixed NA birth_order_nonlinear5 -0.008226 0.04369 -0.1883 10754 0.8507 -0.09387 0.07741
fixed NA birth_order_nonlinear>5 -0.03737 0.04097 -0.912 11786 0.3618 -0.1177 0.04294
ran_pars mother_pidlink sd__(Intercept) 0.4416 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8566 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.495 0.1239 -20.13 11707 1.24e-88 -2.738 -2.252
fixed NA poly(age, 3, raw = TRUE)1 0.4073 0.02263 18 11731 1.786e-71 0.363 0.4517
fixed NA poly(age, 3, raw = TRUE)2 -0.01828 0.001306 -13.99 11800 3.917e-44 -0.02084 -0.01572
fixed NA poly(age, 3, raw = TRUE)3 0.0002531 0.00002392 10.58 11817 4.758e-26 0.0002062 0.0003
fixed NA male -0.1617 0.01738 -9.306 11410 1.575e-20 -0.1958 -0.1277
fixed NA count_birth_order2/2 0.0442 0.0389 1.136 9894 0.256 -0.03205 0.1204
fixed NA count_birth_order1/3 0.003874 0.03882 0.09977 11677 0.9205 -0.07222 0.07997
fixed NA count_birth_order2/3 0.01011 0.03964 0.2552 11737 0.7986 -0.06758 0.08781
fixed NA count_birth_order3/3 0.02486 0.04499 0.5525 11805 0.5806 -0.06332 0.113
fixed NA count_birth_order1/4 -0.09987 0.05334 -1.872 11816 0.06118 -0.2044 0.004673
fixed NA count_birth_order2/4 -0.08891 0.05068 -1.754 11817 0.07938 -0.1882 0.01042
fixed NA count_birth_order3/4 -0.031 0.04767 -0.6502 11803 0.5156 -0.1244 0.06244
fixed NA count_birth_order4/4 -0.0841 0.05214 -1.613 11816 0.1067 -0.1863 0.01808
fixed NA count_birth_order1/5 -0.03411 0.07281 -0.4685 11659 0.6394 -0.1768 0.1086
fixed NA count_birth_order2/5 -0.04574 0.06923 -0.6606 11708 0.5089 -0.1814 0.08996
fixed NA count_birth_order3/5 0.04814 0.06259 0.7691 11784 0.4418 -0.07453 0.1708
fixed NA count_birth_order4/5 -0.1116 0.05873 -1.9 11814 0.05743 -0.2267 0.003508
fixed NA count_birth_order5/5 -0.01722 0.05821 -0.2958 11817 0.7674 -0.1313 0.09687
fixed NA count_birth_order1/>5 -0.1167 0.07317 -1.595 11436 0.1107 -0.2601 0.02668
fixed NA count_birth_order2/>5 -0.2274 0.06847 -3.322 11490 0.0008975 -0.3616 -0.09323
fixed NA count_birth_order3/>5 -0.06418 0.06079 -1.056 11658 0.2911 -0.1833 0.05497
fixed NA count_birth_order4/>5 -0.1983 0.05525 -3.589 11720 0.0003331 -0.3066 -0.09001
fixed NA count_birth_order5/>5 -0.1984 0.04952 -4.007 11794 0.00006199 -0.2954 -0.1013
fixed NA count_birth_order>5/>5 -0.209 0.03399 -6.149 10554 0.0000000008089 -0.2756 -0.1424
ran_pars mother_pidlink sd__(Intercept) 0.4408 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8571 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 32480 32561 -16229 32458 NA NA NA
12 32480 32569 -16228 32456 1.564 1 0.2111
16 32480 32598 -16224 32448 7.826 4 0.09815
26 32494 32686 -16221 32442 6.537 10 0.7683

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.104 0.1915 -16.21 7417 4.273e-58 -3.48 -2.729
fixed NA poly(age, 3, raw = TRUE)1 0.5371 0.03932 13.66 7380 5.565e-42 0.4601 0.6142
fixed NA poly(age, 3, raw = TRUE)2 -0.02639 0.002491 -10.59 7396 4.852e-26 -0.03128 -0.02151
fixed NA poly(age, 3, raw = TRUE)3 0.0004132 0.00004907 8.422 7408 4.397e-17 0.0003171 0.0005094
fixed NA male -0.1782 0.0206 -8.647 8178 6.295e-18 -0.2185 -0.1378
fixed NA sibling_count3 -0.004614 0.02826 -0.1633 5422 0.8703 -0.06001 0.05078
fixed NA sibling_count4 -0.0559 0.03451 -1.62 4621 0.1054 -0.1235 0.01174
fixed NA sibling_count5 -0.1578 0.04412 -3.575 4100 0.0003541 -0.2442 -0.07127
fixed NA sibling_count>5 -0.2106 0.04109 -5.126 4237 0.0000003098 -0.2911 -0.1301
ran_pars mother_pidlink sd__(Intercept) 0.4467 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8555 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.11 0.1937 -16.06 7596 4.176e-57 -3.49 -2.731
fixed NA birth_order 0.001986 0.009122 0.2177 8089 0.8276 -0.01589 0.01987
fixed NA poly(age, 3, raw = TRUE)1 0.5377 0.03941 13.64 7423 6.926e-42 0.4605 0.615
fixed NA poly(age, 3, raw = TRUE)2 -0.02642 0.002495 -10.59 7414 5.039e-26 -0.03131 -0.02153
fixed NA poly(age, 3, raw = TRUE)3 0.0004138 0.00004912 8.423 7423 4.379e-17 0.0003175 0.00051
fixed NA male -0.1782 0.0206 -8.647 8177 6.298e-18 -0.2186 -0.1378
fixed NA sibling_count3 -0.005917 0.02889 -0.2048 5377 0.8377 -0.06254 0.05071
fixed NA sibling_count4 -0.05879 0.03699 -1.589 4607 0.112 -0.1313 0.0137
fixed NA sibling_count5 -0.1626 0.04936 -3.293 4248 0.0009976 -0.2593 -0.06582
fixed NA sibling_count>5 -0.22 0.05974 -3.683 4985 0.000233 -0.3371 -0.1029
ran_pars mother_pidlink sd__(Intercept) 0.4468 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8555 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.126 0.1933 -16.18 7553 6.955e-58 -3.505 -2.747
fixed NA poly(age, 3, raw = TRUE)1 0.5394 0.03943 13.68 7421 4.39e-42 0.4621 0.6166
fixed NA poly(age, 3, raw = TRUE)2 -0.02653 0.002495 -10.63 7407 3.295e-26 -0.03142 -0.02164
fixed NA poly(age, 3, raw = TRUE)3 0.0004159 0.00004913 8.465 7420 3.048e-17 0.0003196 0.0005122
fixed NA male -0.1786 0.02061 -8.664 8175 5.425e-18 -0.2189 -0.1382
fixed NA sibling_count3 -0.00646 0.03024 -0.2136 5876 0.8309 -0.06573 0.05281
fixed NA sibling_count4 -0.05353 0.04007 -1.336 5368 0.1816 -0.1321 0.025
fixed NA sibling_count5 -0.1354 0.05447 -2.485 5132 0.01299 -0.2421 -0.02859
fixed NA sibling_count>5 -0.2334 0.06479 -3.603 5696 0.0003171 -0.3604 -0.1065
fixed NA birth_order_nonlinear2 0.02891 0.02498 1.157 6415 0.2472 -0.02005 0.07787
fixed NA birth_order_nonlinear3 0.004704 0.03478 0.1352 7295 0.8924 -0.06347 0.07288
fixed NA birth_order_nonlinear4 -0.002522 0.04752 -0.05308 7690 0.9577 -0.09565 0.09061
fixed NA birth_order_nonlinear5 -0.04888 0.06391 -0.7648 7734 0.4444 -0.1741 0.07638
fixed NA birth_order_nonlinear>5 0.07078 0.07314 0.9677 8425 0.3332 -0.07258 0.2141
ran_pars mother_pidlink sd__(Intercept) 0.447 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8554 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.134 0.1942 -16.14 7569 1.232e-57 -3.514 -2.753
fixed NA poly(age, 3, raw = TRUE)1 0.5388 0.03953 13.63 7426 8.181e-42 0.4614 0.6163
fixed NA poly(age, 3, raw = TRUE)2 -0.0265 0.002502 -10.59 7408 5.046e-26 -0.0314 -0.02159
fixed NA poly(age, 3, raw = TRUE)3 0.0004153 0.00004926 8.43 7417 4.116e-17 0.0003187 0.0005118
fixed NA male -0.1777 0.02062 -8.619 8162 8.038e-18 -0.2182 -0.1373
fixed NA count_birth_order2/2 0.05606 0.03495 1.604 6889 0.1088 -0.01245 0.1246
fixed NA count_birth_order1/3 0.03115 0.04032 0.7725 8415 0.4398 -0.04788 0.1102
fixed NA count_birth_order2/3 0.02824 0.0388 0.7279 8425 0.4667 -0.0478 0.1043
fixed NA count_birth_order3/3 -0.01949 0.04253 -0.4582 8444 0.6468 -0.1028 0.06387
fixed NA count_birth_order1/4 -0.082 0.06396 -1.282 8381 0.1999 -0.2074 0.04337
fixed NA count_birth_order2/4 -0.06803 0.05601 -1.215 8439 0.2245 -0.1778 0.04174
fixed NA count_birth_order3/4 -0.009767 0.05347 -0.1827 8438 0.8551 -0.1146 0.09503
fixed NA count_birth_order4/4 -0.007113 0.05289 -0.1345 8447 0.893 -0.1108 0.09656
fixed NA count_birth_order1/5 -0.079 0.1123 -0.7037 7786 0.4816 -0.299 0.141
fixed NA count_birth_order2/5 -0.0711 0.09979 -0.7125 8036 0.4762 -0.2667 0.1245
fixed NA count_birth_order3/5 -0.07822 0.08421 -0.9289 8281 0.353 -0.2433 0.08682
fixed NA count_birth_order4/5 -0.1583 0.0694 -2.281 8440 0.02256 -0.2943 -0.0223
fixed NA count_birth_order5/5 -0.192 0.06727 -2.855 8447 0.00432 -0.3239 -0.06018
fixed NA count_birth_order1/>5 -0.1892 0.1439 -1.315 7433 0.1886 -0.4711 0.0928
fixed NA count_birth_order2/>5 -0.1647 0.1316 -1.252 7474 0.2105 -0.4226 0.09312
fixed NA count_birth_order3/>5 -0.2041 0.1084 -1.883 7920 0.05978 -0.4165 0.008378
fixed NA count_birth_order4/>5 -0.3053 0.09716 -3.142 8039 0.001684 -0.4957 -0.1148
fixed NA count_birth_order5/>5 -0.2496 0.07779 -3.208 8316 0.001341 -0.4021 -0.09711
fixed NA count_birth_order>5/>5 -0.1526 0.05088 -2.999 7313 0.00272 -0.2523 -0.05286
ran_pars mother_pidlink sd__(Intercept) 0.446 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8561 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 23286 23364 -11632 23264 NA NA NA
12 23288 23373 -11632 23264 0.04718 1 0.828
16 23292 23405 -11630 23260 4.367 4 0.3586
26 23305 23489 -11627 23253 6.595 10 0.7631

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.094 0.1905 -16.24 7523 2.541e-58 -3.467 -2.72
fixed NA poly(age, 3, raw = TRUE)1 0.5341 0.03912 13.65 7470 6.124e-42 0.4575 0.6108
fixed NA poly(age, 3, raw = TRUE)2 -0.02625 0.00248 -10.58 7484 5.384e-26 -0.03111 -0.02139
fixed NA poly(age, 3, raw = TRUE)3 0.0004103 0.00004886 8.398 7495 5.374e-17 0.0003145 0.0005061
fixed NA male -0.1813 0.02048 -8.849 8275 1.062e-18 -0.2214 -0.1411
fixed NA sibling_count3 0.01962 0.02964 0.6619 5744 0.5081 -0.03847 0.0777
fixed NA sibling_count4 -0.04539 0.03474 -1.307 5116 0.1914 -0.1135 0.02269
fixed NA sibling_count5 -0.05441 0.0406 -1.34 4649 0.1803 -0.134 0.02517
fixed NA sibling_count>5 -0.1553 0.03618 -4.292 4658 0.00001809 -0.2262 -0.08437
ran_pars mother_pidlink sd__(Intercept) 0.4484 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8547 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.063 0.1921 -15.94 7656 2.648e-56 -3.439 -2.686
fixed NA birth_order -0.009473 0.007631 -1.241 8058 0.2145 -0.02443 0.005484
fixed NA poly(age, 3, raw = TRUE)1 0.5313 0.03919 13.56 7501 2.249e-41 0.4544 0.6081
fixed NA poly(age, 3, raw = TRUE)2 -0.02611 0.002483 -10.52 7496 1.084e-25 -0.03098 -0.02125
fixed NA poly(age, 3, raw = TRUE)3 0.0004079 0.0000489 8.342 7505 8.62e-17 0.0003121 0.0005037
fixed NA male -0.181 0.02048 -8.835 8275 1.203e-18 -0.2211 -0.1408
fixed NA sibling_count3 0.02553 0.03001 0.8508 5719 0.3949 -0.03329 0.08435
fixed NA sibling_count4 -0.0321 0.03634 -0.8832 5090 0.3772 -0.1033 0.03913
fixed NA sibling_count5 -0.03351 0.04394 -0.7625 4701 0.4458 -0.1196 0.05262
fixed NA sibling_count>5 -0.1126 0.04991 -2.256 5220 0.02408 -0.2105 -0.0148
ran_pars mother_pidlink sd__(Intercept) 0.4477 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.855 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.096 0.192 -16.12 7629 1.584e-57 -3.473 -2.72
fixed NA poly(age, 3, raw = TRUE)1 0.5334 0.03921 13.61 7495 1.165e-41 0.4566 0.6103
fixed NA poly(age, 3, raw = TRUE)2 -0.02621 0.002483 -10.56 7485 7.226e-26 -0.03107 -0.02134
fixed NA poly(age, 3, raw = TRUE)3 0.0004093 0.00004889 8.372 7495 6.712e-17 0.0003135 0.0005052
fixed NA male -0.1816 0.02048 -8.865 8270 9.264e-19 -0.2217 -0.1414
fixed NA sibling_count3 0.008918 0.03129 0.2851 6162 0.7756 -0.0524 0.07024
fixed NA sibling_count4 -0.04393 0.03939 -1.115 5828 0.2647 -0.1211 0.03326
fixed NA sibling_count5 -0.02658 0.04819 -0.5516 5560 0.5812 -0.121 0.06787
fixed NA sibling_count>5 -0.1216 0.05324 -2.285 6031 0.02237 -0.226 -0.01729
fixed NA birth_order_nonlinear2 0.01922 0.02567 0.7485 6552 0.4542 -0.0311 0.06954
fixed NA birth_order_nonlinear3 0.03887 0.03402 1.143 7520 0.2532 -0.0278 0.1055
fixed NA birth_order_nonlinear4 -0.03314 0.04453 -0.7443 7873 0.4567 -0.1204 0.05414
fixed NA birth_order_nonlinear5 -0.07932 0.05598 -1.417 7851 0.1565 -0.189 0.03039
fixed NA birth_order_nonlinear>5 -0.02667 0.06012 -0.4437 8550 0.6573 -0.1445 0.09115
ran_pars mother_pidlink sd__(Intercept) 0.449 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8544 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.101 0.193 -16.06 7645 3.947e-57 -3.479 -2.722
fixed NA poly(age, 3, raw = TRUE)1 0.5322 0.03927 13.55 7501 2.367e-41 0.4552 0.6092
fixed NA poly(age, 3, raw = TRUE)2 -0.02612 0.002487 -10.51 7484 1.232e-25 -0.031 -0.02125
fixed NA poly(age, 3, raw = TRUE)3 0.0004076 0.00004897 8.324 7489 1.005e-16 0.0003116 0.0005036
fixed NA male -0.1814 0.02049 -8.852 8258 1.036e-18 -0.2216 -0.1412
fixed NA count_birth_order2/2 0.04505 0.03813 1.182 6967 0.2373 -0.02967 0.1198
fixed NA count_birth_order1/3 0.05846 0.0417 1.402 8520 0.161 -0.02328 0.1402
fixed NA count_birth_order2/3 0.03561 0.0408 0.8727 8530 0.3828 -0.04436 0.1156
fixed NA count_birth_order3/3 0.009352 0.04477 0.2089 8544 0.8345 -0.07839 0.09709
fixed NA count_birth_order1/4 -0.1275 0.0624 -2.043 8513 0.04111 -0.2498 -0.005167
fixed NA count_birth_order2/4 -0.05352 0.05596 -0.9563 8537 0.3389 -0.1632 0.05616
fixed NA count_birth_order3/4 0.04619 0.05355 0.8626 8542 0.3884 -0.05877 0.1512
fixed NA count_birth_order4/4 -0.01379 0.05409 -0.2549 8549 0.7988 -0.1198 0.09222
fixed NA count_birth_order1/5 0.04611 0.09122 0.5055 8195 0.6132 -0.1327 0.2249
fixed NA count_birth_order2/5 -0.02527 0.08146 -0.3102 8369 0.7564 -0.1849 0.1344
fixed NA count_birth_order3/5 0.07466 0.07305 1.022 8450 0.3068 -0.06851 0.2178
fixed NA count_birth_order4/5 -0.09296 0.06719 -1.384 8507 0.1665 -0.2246 0.03873
fixed NA count_birth_order5/5 -0.108 0.06459 -1.672 8547 0.09456 -0.2346 0.0186
fixed NA count_birth_order1/>5 -0.1115 0.09781 -1.14 8043 0.2542 -0.3032 0.08019
fixed NA count_birth_order2/>5 -0.04052 0.109 -0.3718 7682 0.7101 -0.2542 0.1731
fixed NA count_birth_order3/>5 -0.05131 0.08401 -0.6108 8194 0.5413 -0.216 0.1133
fixed NA count_birth_order4/>5 -0.2026 0.07702 -2.63 8284 0.008547 -0.3535 -0.05163
fixed NA count_birth_order5/>5 -0.1804 0.06692 -2.697 8418 0.007021 -0.3116 -0.04929
fixed NA count_birth_order>5/>5 -0.139 0.04611 -3.015 7713 0.002581 -0.2294 -0.04864
ran_pars mother_pidlink sd__(Intercept) 0.4485 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8545 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 23568 23646 -11773 23546 NA NA NA
12 23568 23653 -11772 23544 1.543 1 0.2141
16 23572 23685 -11770 23540 4.59 4 0.332
26 23580 23763 -11764 23528 12.22 10 0.2709

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.076 0.1931 -15.93 7213 3.423e-56 -3.455 -2.698
fixed NA poly(age, 3, raw = TRUE)1 0.5318 0.03963 13.42 7180 1.442e-40 0.4541 0.6095
fixed NA poly(age, 3, raw = TRUE)2 -0.02602 0.00251 -10.37 7198 5.199e-25 -0.03094 -0.0211
fixed NA poly(age, 3, raw = TRUE)3 0.0004051 0.0000494 8.201 7210 2.792e-16 0.0003083 0.0005019
fixed NA male -0.1757 0.02083 -8.438 7953 3.797e-17 -0.2166 -0.1349
fixed NA sibling_count3 -0.01308 0.02837 -0.461 5265 0.6448 -0.06868 0.04252
fixed NA sibling_count4 -0.05899 0.03492 -1.689 4471 0.09122 -0.1274 0.00945
fixed NA sibling_count5 -0.1589 0.04606 -3.449 3979 0.0005685 -0.2491 -0.06859
fixed NA sibling_count>5 -0.2128 0.04257 -4.998 4119 0.0000006033 -0.2962 -0.1293
ran_pars mother_pidlink sd__(Intercept) 0.4509 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8514 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.092 0.1955 -15.81 7393 2.017e-55 -3.475 -2.708
fixed NA birth_order 0.00463 0.009373 0.494 8010 0.6213 -0.01374 0.023
fixed NA poly(age, 3, raw = TRUE)1 0.5333 0.03974 13.42 7227 1.437e-40 0.4554 0.6112
fixed NA poly(age, 3, raw = TRUE)2 -0.02609 0.002514 -10.38 7218 4.644e-25 -0.03102 -0.02117
fixed NA poly(age, 3, raw = TRUE)3 0.0004064 0.00004947 8.216 7226 2.476e-16 0.0003095 0.0005034
fixed NA male -0.1758 0.02083 -8.439 7952 3.774e-17 -0.2166 -0.1349
fixed NA sibling_count3 -0.01609 0.02902 -0.5545 5232 0.5793 -0.07296 0.04078
fixed NA sibling_count4 -0.0657 0.03747 -1.753 4494 0.07961 -0.1392 0.007743
fixed NA sibling_count5 -0.1699 0.05117 -3.32 4154 0.0009083 -0.2702 -0.06958
fixed NA sibling_count>5 -0.2345 0.06122 -3.83 4925 0.0001297 -0.3545 -0.1145
ran_pars mother_pidlink sd__(Intercept) 0.451 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8514 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.104 0.195 -15.92 7354 4.046e-56 -3.487 -2.722
fixed NA poly(age, 3, raw = TRUE)1 0.535 0.03977 13.45 7229 9.088e-41 0.4571 0.613
fixed NA poly(age, 3, raw = TRUE)2 -0.0262 0.002515 -10.42 7218 3.192e-25 -0.03113 -0.02127
fixed NA poly(age, 3, raw = TRUE)3 0.0004084 0.00004949 8.251 7233 1.85e-16 0.0003114 0.0005054
fixed NA male -0.1762 0.02083 -8.455 7950 3.277e-17 -0.217 -0.1353
fixed NA sibling_count3 -0.01488 0.03034 -0.4904 5716 0.6239 -0.07435 0.04459
fixed NA sibling_count4 -0.06779 0.04052 -1.673 5244 0.09435 -0.1472 0.01162
fixed NA sibling_count5 -0.1548 0.05619 -2.754 4945 0.005902 -0.2649 -0.04464
fixed NA sibling_count>5 -0.2456 0.06644 -3.696 5579 0.0002211 -0.3758 -0.1153
fixed NA birth_order_nonlinear2 0.02627 0.02496 1.052 6231 0.2926 -0.02265 0.0752
fixed NA birth_order_nonlinear3 0.003957 0.03499 0.1131 7046 0.91 -0.06463 0.07254
fixed NA birth_order_nonlinear4 0.03323 0.04852 0.6848 7395 0.4935 -0.06187 0.1283
fixed NA birth_order_nonlinear5 -0.02669 0.06674 -0.3999 7529 0.6892 -0.1575 0.1041
fixed NA birth_order_nonlinear>5 0.07335 0.07557 0.9707 8221 0.3317 -0.07476 0.2215
ran_pars mother_pidlink sd__(Intercept) 0.4505 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8517 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.108 0.1959 -15.87 7368 8.98e-56 -3.492 -2.724
fixed NA poly(age, 3, raw = TRUE)1 0.5337 0.03987 13.39 7233 2.135e-40 0.4556 0.6119
fixed NA poly(age, 3, raw = TRUE)2 -0.02612 0.002521 -10.36 7218 5.6e-25 -0.03107 -0.02118
fixed NA poly(age, 3, raw = TRUE)3 0.0004071 0.00004962 8.205 7228 2.71e-16 0.0003098 0.0005043
fixed NA male -0.1755 0.02085 -8.42 7940 4.413e-17 -0.2164 -0.1347
fixed NA count_birth_order2/2 0.05598 0.0346 1.618 6647 0.1057 -0.01183 0.1238
fixed NA count_birth_order1/3 0.0261 0.04051 0.6443 8194 0.5194 -0.0533 0.1055
fixed NA count_birth_order2/3 0.01806 0.03892 0.464 8202 0.6427 -0.05822 0.09434
fixed NA count_birth_order3/3 -0.02986 0.04272 -0.6989 8222 0.4846 -0.1136 0.05387
fixed NA count_birth_order1/4 -0.09554 0.06434 -1.485 8164 0.1376 -0.2216 0.03056
fixed NA count_birth_order2/4 -0.0866 0.05675 -1.526 8214 0.1271 -0.1978 0.02463
fixed NA count_birth_order3/4 -0.0142 0.05387 -0.2637 8215 0.792 -0.1198 0.09137
fixed NA count_birth_order4/4 0.009754 0.05365 0.1818 8224 0.8557 -0.0954 0.1149
fixed NA count_birth_order1/5 -0.05029 0.1121 -0.4487 7670 0.6537 -0.2699 0.1694
fixed NA count_birth_order2/5 -0.1172 0.1071 -1.094 7742 0.2739 -0.3272 0.09276
fixed NA count_birth_order3/5 -0.1053 0.08641 -1.218 8091 0.2231 -0.2747 0.06408
fixed NA count_birth_order4/5 -0.123 0.07302 -1.685 8215 0.0921 -0.2661 0.02011
fixed NA count_birth_order5/5 -0.2081 0.0713 -2.919 8224 0.003519 -0.3479 -0.0684
fixed NA count_birth_order1/>5 -0.2608 0.145 -1.799 7182 0.07205 -0.545 0.02333
fixed NA count_birth_order2/>5 -0.1588 0.1336 -1.188 7341 0.2347 -0.4207 0.1031
fixed NA count_birth_order3/>5 -0.2241 0.1089 -2.058 7773 0.03964 -0.4375 -0.01066
fixed NA count_birth_order4/>5 -0.3077 0.1033 -2.979 7755 0.002905 -0.5102 -0.1052
fixed NA count_birth_order5/>5 -0.2128 0.08176 -2.602 8076 0.00928 -0.373 -0.05251
fixed NA count_birth_order>5/>5 -0.1609 0.05288 -3.043 7148 0.002353 -0.2646 -0.05726
ran_pars mother_pidlink sd__(Intercept) 0.4492 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8523 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 22637 22714 -11307 22615 NA NA NA
12 22638 22723 -11307 22614 0.2439 1 0.6214
16 22643 22756 -11306 22611 3.053 4 0.549
26 22655 22837 -11302 22603 8.409 10 0.5889

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Counting backwards

birthorder <- birthorder %>% mutate(outcome = count_backwards)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5158 0.1653 -3.12 13453 0.001811 -0.8398 -0.1918
fixed NA poly(age, 3, raw = TRUE)1 0.06972 0.01599 4.359 13347 0.00001318 0.03837 0.1011
fixed NA poly(age, 3, raw = TRUE)2 -0.002356 0.0004765 -4.944 13137 0.0000007756 -0.00329 -0.001422
fixed NA poly(age, 3, raw = TRUE)3 0.00002179 0.000004446 4.9 12884 0.0000009705 0.00001307 0.0000305
fixed NA male 0.04321 0.01663 2.599 13172 0.009371 0.01062 0.0758
fixed NA sibling_count3 0.002307 0.03444 0.06697 9806 0.9466 -0.0652 0.06981
fixed NA sibling_count4 0.03135 0.03566 0.8792 9020 0.3793 -0.03854 0.1012
fixed NA sibling_count5 0.0143 0.03708 0.3855 8214 0.6999 -0.05838 0.08698
fixed NA sibling_count>5 -0.1004 0.0291 -3.449 9139 0.0005653 -0.1574 -0.04334
ran_pars mother_pidlink sd__(Intercept) 0.4186 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8969 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.521 0.1653 -3.152 13453 0.001623 -0.845 -0.1971
fixed NA birth_order -0.007541 0.003559 -2.119 13003 0.0341 -0.01452 -0.0005663
fixed NA poly(age, 3, raw = TRUE)1 0.07236 0.01604 4.511 13322 0.000006498 0.04092 0.1038
fixed NA poly(age, 3, raw = TRUE)2 -0.002453 0.0004786 -5.125 13056 0.0000003019 -0.003391 -0.001515
fixed NA poly(age, 3, raw = TRUE)3 0.0000227 0.000004466 5.083 12770 0.0000003776 0.00001395 0.00003145
fixed NA male 0.04349 0.01663 2.615 13175 0.00893 0.01089 0.07608
fixed NA sibling_count3 0.00394 0.03443 0.1144 9820 0.9089 -0.06355 0.07143
fixed NA sibling_count4 0.03655 0.03572 1.023 9082 0.3062 -0.03346 0.1066
fixed NA sibling_count5 0.0234 0.03731 0.6272 8326 0.5305 -0.04972 0.09652
fixed NA sibling_count>5 -0.07194 0.03204 -2.246 10244 0.02475 -0.1347 -0.009149
ran_pars mother_pidlink sd__(Intercept) 0.4172 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8973 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5287 0.1657 -3.19 13447 0.001427 -0.8536 -0.2039
fixed NA poly(age, 3, raw = TRUE)1 0.07327 0.01604 4.567 13329 0.000004985 0.04183 0.1047
fixed NA poly(age, 3, raw = TRUE)2 -0.002467 0.0004786 -5.154 13064 0.0000002584 -0.003405 -0.001529
fixed NA poly(age, 3, raw = TRUE)3 0.00002265 0.000004468 5.069 12764 0.0000004065 0.00001389 0.0000314
fixed NA male 0.04386 0.01662 2.638 13164 0.008342 0.01128 0.07644
fixed NA sibling_count3 0.0181 0.03489 0.5187 10123 0.604 -0.05029 0.08648
fixed NA sibling_count4 0.05936 0.03668 1.618 9717 0.1056 -0.01253 0.1313
fixed NA sibling_count5 0.05141 0.03865 1.33 9147 0.1835 -0.02434 0.1272
fixed NA sibling_count>5 -0.04218 0.03354 -1.258 11185 0.2086 -0.1079 0.02356
fixed NA birth_order_nonlinear2 -0.03426 0.02401 -1.427 12248 0.1537 -0.08133 0.0128
fixed NA birth_order_nonlinear3 -0.08943 0.02829 -3.162 11909 0.001573 -0.1449 -0.03399
fixed NA birth_order_nonlinear4 -0.08064 0.03218 -2.506 11938 0.01223 -0.1437 -0.01756
fixed NA birth_order_nonlinear5 -0.08633 0.03661 -2.358 11926 0.01837 -0.1581 -0.01458
fixed NA birth_order_nonlinear>5 -0.09508 0.03072 -3.095 13503 0.001974 -0.1553 -0.03486
ran_pars mother_pidlink sd__(Intercept) 0.4188 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8965 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5266 0.1665 -3.163 13433 0.001562 -0.8529 -0.2003
fixed NA poly(age, 3, raw = TRUE)1 0.07317 0.01605 4.56 13313 0.000005162 0.04172 0.1046
fixed NA poly(age, 3, raw = TRUE)2 -0.002458 0.0004789 -5.132 13037 0.00000029 -0.003396 -0.001519
fixed NA poly(age, 3, raw = TRUE)3 0.00002251 0.000004471 5.034 12723 0.0000004873 0.00001374 0.00003127
fixed NA male 0.04425 0.01663 2.661 13153 0.007799 0.01166 0.07683
fixed NA count_birth_order2/2 -0.04338 0.04687 -0.9254 12433 0.3548 -0.1352 0.04849
fixed NA count_birth_order1/3 0.03772 0.04498 0.8386 13309 0.4017 -0.05044 0.1259
fixed NA count_birth_order2/3 -0.0197 0.05012 -0.393 13454 0.6943 -0.1179 0.07853
fixed NA count_birth_order3/3 -0.1232 0.05612 -2.195 13559 0.02821 -0.2332 -0.01317
fixed NA count_birth_order1/4 0.0815 0.05147 1.583 13460 0.1134 -0.01938 0.1824
fixed NA count_birth_order2/4 0.005026 0.05402 0.09305 13510 0.9259 -0.1009 0.1109
fixed NA count_birth_order3/4 -0.06449 0.05836 -1.105 13578 0.2692 -0.1789 0.0499
fixed NA count_birth_order4/4 -0.009001 0.06157 -0.1462 13598 0.8838 -0.1297 0.1117
fixed NA count_birth_order1/5 -0.0384 0.05782 -0.6642 13554 0.5066 -0.1517 0.07492
fixed NA count_birth_order2/5 0.06285 0.06083 1.033 13587 0.3015 -0.05637 0.1821
fixed NA count_birth_order3/5 0.03161 0.06263 0.5048 13600 0.6137 -0.09113 0.1544
fixed NA count_birth_order4/5 -0.05632 0.06619 -0.851 13605 0.3948 -0.186 0.0734
fixed NA count_birth_order5/5 -0.03531 0.06734 -0.5243 13602 0.6001 -0.1673 0.09668
fixed NA count_birth_order1/>5 -0.05063 0.04693 -1.079 13601 0.2807 -0.1426 0.04136
fixed NA count_birth_order2/>5 -0.08895 0.04831 -1.841 13605 0.06562 -0.1836 0.005739
fixed NA count_birth_order3/>5 -0.1235 0.04744 -2.604 13604 0.00923 -0.2165 -0.03054
fixed NA count_birth_order4/>5 -0.1254 0.04636 -2.705 13605 0.006841 -0.2163 -0.03454
fixed NA count_birth_order5/>5 -0.1327 0.0467 -2.842 13604 0.004491 -0.2243 -0.04119
fixed NA count_birth_order>5/>5 -0.1408 0.03701 -3.804 12216 0.0001434 -0.2133 -0.06823
ran_pars mother_pidlink sd__(Intercept) 0.4189 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8965 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 38110 38193 -19044 38088 NA NA NA
12 38108 38198 -19042 38084 4.489 1 0.03411
16 38105 38225 -19037 38073 10.57 4 0.03183
26 38116 38311 -19032 38064 9.266 10 0.507

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.742 0.4065 -4.284 5752 0.00001864 -2.538 -0.9448
fixed NA poly(age, 3, raw = TRUE)1 0.2094 0.04611 4.543 5754 0.000005671 0.1191 0.2998
fixed NA poly(age, 3, raw = TRUE)2 -0.006882 0.001645 -4.185 5757 0.00002899 -0.01011 -0.003659
fixed NA poly(age, 3, raw = TRUE)3 0.00007036 0.00001862 3.779 5763 0.000159 0.00003387 0.0001069
fixed NA male -0.002035 0.02375 -0.08571 5664 0.9317 -0.04858 0.04451
fixed NA sibling_count3 -0.00724 0.0379 -0.191 4223 0.8485 -0.08152 0.06704
fixed NA sibling_count4 -0.0264 0.04103 -0.6435 3750 0.52 -0.1068 0.05401
fixed NA sibling_count5 -0.07347 0.04681 -1.569 3408 0.1166 -0.1652 0.01828
fixed NA sibling_count>5 -0.1963 0.04127 -4.756 3243 0.00000206 -0.2772 -0.1154
ran_pars mother_pidlink sd__(Intercept) 0.3845 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8347 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.734 0.4066 -4.266 5752 0.00002025 -2.531 -0.9374
fixed NA birth_order -0.008164 0.00792 -1.031 5827 0.3027 -0.02369 0.00736
fixed NA poly(age, 3, raw = TRUE)1 0.2098 0.04611 4.55 5754 0.000005469 0.1194 0.3002
fixed NA poly(age, 3, raw = TRUE)2 -0.006883 0.001645 -4.185 5757 0.00002896 -0.01011 -0.003659
fixed NA poly(age, 3, raw = TRUE)3 0.00007005 0.00001862 3.762 5761 0.0001706 0.00003355 0.0001065
fixed NA male -0.001657 0.02375 -0.06975 5664 0.9444 -0.04821 0.04489
fixed NA sibling_count3 -0.003215 0.03809 -0.08441 4230 0.9327 -0.07787 0.07144
fixed NA sibling_count4 -0.01684 0.04205 -0.4004 3768 0.6889 -0.09925 0.06558
fixed NA sibling_count5 -0.05794 0.04916 -1.179 3509 0.2387 -0.1543 0.03842
fixed NA sibling_count>5 -0.1653 0.05105 -3.238 3789 0.001215 -0.2653 -0.06523
ran_pars mother_pidlink sd__(Intercept) 0.3836 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.835 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.751 0.4073 -4.3 5759 0.00001736 -2.549 -0.953
fixed NA poly(age, 3, raw = TRUE)1 0.2103 0.04614 4.558 5755 0.000005264 0.1199 0.3008
fixed NA poly(age, 3, raw = TRUE)2 -0.006901 0.001646 -4.193 5756 0.00002796 -0.01013 -0.003675
fixed NA poly(age, 3, raw = TRUE)3 0.00007025 0.00001864 3.769 5760 0.0001655 0.00003372 0.0001068
fixed NA male -0.001182 0.02375 -0.04974 5657 0.9603 -0.04774 0.04538
fixed NA sibling_count3 0.007384 0.03885 0.1901 4413 0.8493 -0.06877 0.08353
fixed NA sibling_count4 -0.003047 0.04364 -0.06983 4087 0.9443 -0.08858 0.08249
fixed NA sibling_count5 -0.04944 0.05155 -0.9591 3926 0.3376 -0.1505 0.05159
fixed NA sibling_count>5 -0.1575 0.05246 -3.002 4038 0.002694 -0.2603 -0.05469
fixed NA birth_order_nonlinear2 0.003951 0.03053 0.1294 4749 0.897 -0.05588 0.06379
fixed NA birth_order_nonlinear3 -0.06261 0.03762 -1.664 4959 0.09608 -0.1363 0.01111
fixed NA birth_order_nonlinear4 -0.03636 0.0466 -0.7802 5103 0.4353 -0.1277 0.05497
fixed NA birth_order_nonlinear5 -0.007188 0.05817 -0.1236 4949 0.9017 -0.1212 0.1068
fixed NA birth_order_nonlinear>5 -0.05932 0.05891 -1.007 5758 0.3141 -0.1748 0.05615
ran_pars mother_pidlink sd__(Intercept) 0.3846 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8348 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.724 0.408 -4.227 5751 0.00002407 -2.524 -0.9248
fixed NA poly(age, 3, raw = TRUE)1 0.205 0.04622 4.435 5744 0.000009364 0.1144 0.2956
fixed NA poly(age, 3, raw = TRUE)2 -0.0067 0.001649 -4.063 5746 0.00004908 -0.009932 -0.003468
fixed NA poly(age, 3, raw = TRUE)3 0.00006785 0.00001868 3.633 5750 0.0002826 0.00003125 0.0001045
fixed NA male -0.003637 0.02376 -0.1531 5644 0.8783 -0.05021 0.04294
fixed NA count_birth_order2/2 0.06035 0.0554 1.089 5061 0.276 -0.04823 0.1689
fixed NA count_birth_order1/3 0.04137 0.04935 0.8382 5765 0.4019 -0.05536 0.1381
fixed NA count_birth_order2/3 0.006316 0.05378 0.1175 5808 0.9065 -0.09909 0.1117
fixed NA count_birth_order3/3 -0.03376 0.05998 -0.5628 5820 0.5736 -0.1513 0.08381
fixed NA count_birth_order1/4 -0.03262 0.06047 -0.5395 5802 0.5896 -0.1511 0.08589
fixed NA count_birth_order2/4 0.0837 0.06257 1.338 5820 0.181 -0.03892 0.2063
fixed NA count_birth_order3/4 -0.07312 0.06565 -1.114 5813 0.2654 -0.2018 0.05555
fixed NA count_birth_order4/4 -0.002899 0.06845 -0.04236 5808 0.9662 -0.1371 0.1313
fixed NA count_birth_order1/5 0.01161 0.08139 0.1427 5818 0.8866 -0.1479 0.1711
fixed NA count_birth_order2/5 -0.07328 0.08756 -0.837 5783 0.4027 -0.2449 0.09833
fixed NA count_birth_order3/5 -0.1484 0.0822 -1.806 5785 0.071 -0.3096 0.01267
fixed NA count_birth_order4/5 -0.03242 0.07917 -0.4095 5801 0.6822 -0.1876 0.1228
fixed NA count_birth_order5/5 -0.02795 0.08174 -0.342 5788 0.7324 -0.1882 0.1322
fixed NA count_birth_order1/>5 -0.05036 0.0809 -0.6225 5798 0.5336 -0.2089 0.1082
fixed NA count_birth_order2/>5 -0.2429 0.0813 -2.987 5776 0.002828 -0.4022 -0.08351
fixed NA count_birth_order3/>5 -0.1141 0.08049 -1.418 5749 0.1563 -0.2719 0.04363
fixed NA count_birth_order4/>5 -0.227 0.07547 -3.008 5749 0.00264 -0.3749 -0.07911
fixed NA count_birth_order5/>5 -0.1526 0.07184 -2.124 5749 0.03375 -0.2934 -0.01176
fixed NA count_birth_order>5/>5 -0.1988 0.05463 -3.639 5402 0.0002762 -0.3059 -0.09173
ran_pars mother_pidlink sd__(Intercept) 0.385 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8344 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15526 15600 -7752 15504 NA NA NA
12 15527 15607 -7752 15503 1.066 1 0.3018
16 15532 15639 -7750 15500 3.189 4 0.5268
26 15540 15713 -7744 15488 12.37 10 0.2613

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.735 0.4053 -4.282 5803 0.00001886 -2.53 -0.9409
fixed NA poly(age, 3, raw = TRUE)1 0.2105 0.04599 4.578 5803 0.0000048 0.1204 0.3006
fixed NA poly(age, 3, raw = TRUE)2 -0.006937 0.001641 -4.228 5806 0.00002394 -0.01015 -0.003721
fixed NA poly(age, 3, raw = TRUE)3 0.00007079 0.00001858 3.81 5813 0.0001403 0.00003437 0.0001072
fixed NA male -0.001301 0.02365 -0.05501 5711 0.9561 -0.04766 0.04506
fixed NA sibling_count3 -0.03781 0.04097 -0.923 4375 0.356 -0.1181 0.04248
fixed NA sibling_count4 -0.007388 0.04336 -0.1704 4006 0.8647 -0.09238 0.0776
fixed NA sibling_count5 -0.06853 0.04634 -1.479 3649 0.1393 -0.1594 0.02229
fixed NA sibling_count>5 -0.1464 0.04069 -3.598 3779 0.0003249 -0.2261 -0.06664
ran_pars mother_pidlink sd__(Intercept) 0.3853 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8346 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.721 0.4053 -4.247 5803 0.00002201 -2.516 -0.927
fixed NA birth_order -0.01171 0.006915 -1.694 5782 0.09032 -0.02527 0.001839
fixed NA poly(age, 3, raw = TRUE)1 0.2106 0.04598 4.58 5804 0.000004737 0.1205 0.3007
fixed NA poly(age, 3, raw = TRUE)2 -0.006923 0.001641 -4.22 5806 0.00002485 -0.01014 -0.003707
fixed NA poly(age, 3, raw = TRUE)3 0.00007016 0.00001858 3.776 5812 0.000161 0.00003374 0.0001066
fixed NA male -0.0008451 0.02365 -0.03573 5713 0.9715 -0.0472 0.04551
fixed NA sibling_count3 -0.03205 0.04109 -0.7799 4376 0.4355 -0.1126 0.04849
fixed NA sibling_count4 0.005742 0.04403 0.1304 4001 0.8962 -0.08055 0.09203
fixed NA sibling_count5 -0.04796 0.04788 -1.002 3677 0.3165 -0.1418 0.04588
fixed NA sibling_count>5 -0.1033 0.04796 -2.154 4106 0.03134 -0.1973 -0.009283
ran_pars mother_pidlink sd__(Intercept) 0.384 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8349 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.737 0.4058 -4.28 5809 0.00001901 -2.532 -0.9414
fixed NA poly(age, 3, raw = TRUE)1 0.2108 0.046 4.584 5804 0.000004666 0.1207 0.301
fixed NA poly(age, 3, raw = TRUE)2 -0.006929 0.001641 -4.222 5806 0.00002462 -0.01015 -0.003712
fixed NA poly(age, 3, raw = TRUE)3 0.00007018 0.00001859 3.775 5810 0.0001615 0.00003374 0.0001066
fixed NA male 0.0001426 0.02365 0.006028 5706 0.9952 -0.04621 0.0465
fixed NA sibling_count3 -0.02208 0.04182 -0.5281 4533 0.5975 -0.104 0.05988
fixed NA sibling_count4 0.0252 0.04553 0.5535 4287 0.58 -0.06404 0.1144
fixed NA sibling_count5 -0.04036 0.05006 -0.8061 4062 0.4202 -0.1385 0.05777
fixed NA sibling_count>5 -0.08923 0.04936 -1.808 4370 0.07069 -0.186 0.007504
fixed NA birth_order_nonlinear2 -0.007419 0.03111 -0.2385 4896 0.8115 -0.06839 0.05355
fixed NA birth_order_nonlinear3 -0.06747 0.03749 -1.8 5088 0.07198 -0.1409 0.006012
fixed NA birth_order_nonlinear4 -0.08405 0.04525 -1.857 5239 0.06331 -0.1728 0.004641
fixed NA birth_order_nonlinear5 0.01327 0.05537 0.2397 5169 0.8105 -0.09524 0.1218
fixed NA birth_order_nonlinear>5 -0.1017 0.05263 -1.933 5872 0.05324 -0.2049 0.001402
ran_pars mother_pidlink sd__(Intercept) 0.3854 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8342 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.753 0.4063 -4.315 5800 0.00001622 -2.55 -0.9569
fixed NA poly(age, 3, raw = TRUE)1 0.2086 0.04603 4.531 5791 0.000005994 0.1183 0.2988
fixed NA poly(age, 3, raw = TRUE)2 -0.006848 0.001643 -4.168 5793 0.00003112 -0.01007 -0.003628
fixed NA poly(age, 3, raw = TRUE)3 0.00006923 0.00001861 3.72 5798 0.0002011 0.00003276 0.0001057
fixed NA male -0.0008112 0.02365 -0.03431 5689 0.9726 -0.04715 0.04553
fixed NA count_birth_order2/2 0.1046 0.0606 1.727 5189 0.08424 -0.01412 0.2234
fixed NA count_birth_order1/3 0.04638 0.05345 0.8677 5815 0.3856 -0.05839 0.1511
fixed NA count_birth_order2/3 -0.03838 0.05776 -0.6645 5856 0.5064 -0.1516 0.07483
fixed NA count_birth_order3/3 -0.04669 0.06486 -0.7199 5871 0.4716 -0.1738 0.08044
fixed NA count_birth_order1/4 0.08308 0.06328 1.313 5851 0.1893 -0.04095 0.2071
fixed NA count_birth_order2/4 0.1233 0.06453 1.91 5869 0.05612 -0.003195 0.2498
fixed NA count_birth_order3/4 -0.09541 0.07025 -1.358 5864 0.1745 -0.2331 0.04228
fixed NA count_birth_order4/4 -0.0516 0.07268 -0.71 5862 0.4778 -0.194 0.09084
fixed NA count_birth_order1/5 -0.01385 0.07452 -0.1859 5870 0.8526 -0.1599 0.1322
fixed NA count_birth_order2/5 -0.068 0.08025 -0.8473 5853 0.3968 -0.2253 0.08929
fixed NA count_birth_order3/5 -0.08213 0.078 -1.053 5851 0.2924 -0.235 0.07074
fixed NA count_birth_order4/5 -0.01231 0.08102 -0.1519 5834 0.8792 -0.1711 0.1465
fixed NA count_birth_order5/5 0.02339 0.08067 0.29 5838 0.7718 -0.1347 0.1815
fixed NA count_birth_order1/>5 -0.04074 0.07093 -0.5743 5871 0.5658 -0.1798 0.09829
fixed NA count_birth_order2/>5 -0.1348 0.0748 -1.802 5843 0.07154 -0.2814 0.01179
fixed NA count_birth_order3/>5 -0.02254 0.07276 -0.3097 5831 0.7568 -0.1651 0.1201
fixed NA count_birth_order4/>5 -0.1605 0.07 -2.292 5832 0.02192 -0.2977 -0.02327
fixed NA count_birth_order5/>5 -0.04646 0.07191 -0.6462 5790 0.5182 -0.1874 0.09447
fixed NA count_birth_order>5/>5 -0.1536 0.05342 -2.876 5498 0.004038 -0.2583 -0.04895
ran_pars mother_pidlink sd__(Intercept) 0.3886 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8324 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15665 15738 -7821 15643 NA NA NA
12 15664 15744 -7820 15640 2.876 1 0.08993
16 15665 15772 -7817 15633 6.217 4 0.1835
26 15669 15843 -7809 15617 16.19 10 0.09423

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.758 0.4107 -4.281 5640 0.00001893 -2.563 -0.9531
fixed NA poly(age, 3, raw = TRUE)1 0.2094 0.0466 4.494 5641 0.00000714 0.1181 0.3007
fixed NA poly(age, 3, raw = TRUE)2 -0.006886 0.001663 -4.142 5644 0.000035 -0.01014 -0.003627
fixed NA poly(age, 3, raw = TRUE)3 0.00007041 0.00001883 3.738 5649 0.0001871 0.00003349 0.0001073
fixed NA male -0.001767 0.02395 -0.07378 5556 0.9412 -0.04872 0.04518
fixed NA sibling_count3 0.02318 0.03734 0.6207 4163 0.5348 -0.05001 0.09636
fixed NA sibling_count4 -0.01709 0.04066 -0.4203 3726 0.6743 -0.09679 0.0626
fixed NA sibling_count5 -0.03092 0.04791 -0.6453 3290 0.5188 -0.1248 0.06299
fixed NA sibling_count>5 -0.1816 0.04168 -4.358 3134 0.00001356 -0.2633 -0.09994
ran_pars mother_pidlink sd__(Intercept) 0.3835 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8335 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.751 0.4107 -4.263 5639 0.00002046 -2.556 -0.9461
fixed NA birth_order -0.009102 0.00815 -1.117 5717 0.2641 -0.02508 0.006872
fixed NA poly(age, 3, raw = TRUE)1 0.2099 0.0466 4.505 5642 0.000006786 0.1186 0.3012
fixed NA poly(age, 3, raw = TRUE)2 -0.006889 0.001663 -4.144 5643 0.0000347 -0.01015 -0.003631
fixed NA poly(age, 3, raw = TRUE)3 0.00007008 0.00001884 3.72 5648 0.0002008 0.00003316 0.000107
fixed NA male -0.001512 0.02396 -0.06313 5556 0.9497 -0.04846 0.04544
fixed NA sibling_count3 0.02767 0.03755 0.737 4170 0.4612 -0.04592 0.1013
fixed NA sibling_count4 -0.006581 0.04173 -0.1577 3757 0.8747 -0.08836 0.0752
fixed NA sibling_count5 -0.01437 0.05014 -0.2867 3385 0.7744 -0.1126 0.0839
fixed NA sibling_count>5 -0.1474 0.05172 -2.85 3768 0.0044 -0.2488 -0.04602
ran_pars mother_pidlink sd__(Intercept) 0.3829 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8337 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.75 0.4113 -4.255 5646 0.00002129 -2.556 -0.9438
fixed NA poly(age, 3, raw = TRUE)1 0.2089 0.04663 4.48 5642 0.000007605 0.1175 0.3003
fixed NA poly(age, 3, raw = TRUE)2 -0.006853 0.001664 -4.119 5642 0.00003861 -0.01011 -0.003592
fixed NA poly(age, 3, raw = TRUE)3 0.00006965 0.00001885 3.695 5645 0.0002217 0.00003271 0.0001066
fixed NA male -0.001605 0.02396 -0.06699 5549 0.9466 -0.04856 0.04535
fixed NA sibling_count3 0.03932 0.03833 1.026 4350 0.3051 -0.03581 0.1144
fixed NA sibling_count4 0.006506 0.04337 0.15 4071 0.8808 -0.0785 0.09151
fixed NA sibling_count5 -0.001042 0.05236 -0.01989 3752 0.9841 -0.1037 0.1016
fixed NA sibling_count>5 -0.1381 0.05322 -2.595 4031 0.009494 -0.2424 -0.03379
fixed NA birth_order_nonlinear2 -0.01308 0.03042 -0.4302 4660 0.6671 -0.0727 0.04653
fixed NA birth_order_nonlinear3 -0.06863 0.03759 -1.826 4850 0.06794 -0.1423 0.005042
fixed NA birth_order_nonlinear4 -0.03461 0.04784 -0.7235 4985 0.4694 -0.1284 0.05915
fixed NA birth_order_nonlinear5 -0.0511 0.06064 -0.8426 4862 0.3995 -0.17 0.06776
fixed NA birth_order_nonlinear>5 -0.06211 0.06069 -1.023 5609 0.3062 -0.181 0.05683
ran_pars mother_pidlink sd__(Intercept) 0.384 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8334 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.72 0.4121 -4.173 5638 0.00003048 -2.527 -0.9121
fixed NA poly(age, 3, raw = TRUE)1 0.2027 0.04671 4.339 5632 0.00001455 0.1111 0.2942
fixed NA poly(age, 3, raw = TRUE)2 -0.006614 0.001667 -3.968 5633 0.00007349 -0.009881 -0.003347
fixed NA poly(age, 3, raw = TRUE)3 0.00006677 0.00001889 3.535 5637 0.0004113 0.00002975 0.0001038
fixed NA male -0.004393 0.02396 -0.1833 5534 0.8545 -0.05136 0.04257
fixed NA count_birth_order2/2 0.05125 0.0538 0.9527 4914 0.3408 -0.05419 0.1567
fixed NA count_birth_order1/3 0.06193 0.04865 1.273 5651 0.203 -0.03342 0.1573
fixed NA count_birth_order2/3 0.0383 0.05364 0.7141 5697 0.4752 -0.06683 0.1434
fixed NA count_birth_order3/3 0.00373 0.05886 0.06337 5704 0.9495 -0.1116 0.1191
fixed NA count_birth_order1/4 0.008194 0.06064 0.1351 5694 0.8925 -0.1107 0.127
fixed NA count_birth_order2/4 0.05461 0.06234 0.8759 5704 0.3811 -0.06759 0.1768
fixed NA count_birth_order3/4 -0.07707 0.06483 -1.189 5694 0.2346 -0.2041 0.05
fixed NA count_birth_order4/4 0.01361 0.06861 0.1983 5684 0.8428 -0.1209 0.1481
fixed NA count_birth_order1/5 0.06726 0.08109 0.8294 5704 0.4069 -0.09168 0.2262
fixed NA count_birth_order2/5 -0.03652 0.09006 -0.4055 5659 0.6851 -0.213 0.14
fixed NA count_birth_order3/5 -0.1304 0.0861 -1.515 5660 0.1299 -0.2992 0.03832
fixed NA count_birth_order4/5 0.03388 0.0827 0.4096 5680 0.6821 -0.1282 0.196
fixed NA count_birth_order5/5 -0.01935 0.08732 -0.2216 5665 0.8246 -0.1905 0.1518
fixed NA count_birth_order1/>5 -0.01061 0.08265 -0.1284 5675 0.8979 -0.1726 0.1514
fixed NA count_birth_order2/>5 -0.2631 0.08334 -3.158 5653 0.001599 -0.4265 -0.09981
fixed NA count_birth_order3/>5 -0.07723 0.0815 -0.9476 5629 0.3434 -0.237 0.08251
fixed NA count_birth_order4/>5 -0.2221 0.07927 -2.802 5599 0.005092 -0.3775 -0.06677
fixed NA count_birth_order5/>5 -0.174 0.07346 -2.368 5623 0.0179 -0.318 -0.03
fixed NA count_birth_order>5/>5 -0.1797 0.05555 -3.235 5279 0.001225 -0.2886 -0.07082
ran_pars mother_pidlink sd__(Intercept) 0.3852 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8326 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15200 15273 -7589 15178 NA NA NA
12 15200 15280 -7588 15176 1.251 1 0.2634
16 15206 15312 -7587 15174 2.534 4 0.6385
26 15211 15384 -7580 15159 14.26 10 0.1615

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Immediate word recall

birthorder <- birthorder %>% mutate(outcome = words_immediate)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3533 0.1522 2.322 13861 0.02026 0.05506 0.6515
fixed NA poly(age, 3, raw = TRUE)1 0.006171 0.01459 0.4228 13811 0.6724 -0.02243 0.03478
fixed NA poly(age, 3, raw = TRUE)2 -0.0004583 0.0004298 -1.066 13691 0.2864 -0.001301 0.0003842
fixed NA poly(age, 3, raw = TRUE)3 0.0000006377 0.000003962 0.161 13541 0.8721 -0.000007128 0.000008403
fixed NA male -0.1026 0.01588 -6.461 13510 0.0000000001074 -0.1337 -0.07148
fixed NA sibling_count3 0.02844 0.03284 0.8661 9962 0.3865 -0.03592 0.0928
fixed NA sibling_count4 0.0288 0.03393 0.8488 9172 0.396 -0.0377 0.0953
fixed NA sibling_count5 -0.005082 0.03538 -0.1436 8311 0.8858 -0.07443 0.06426
fixed NA sibling_count>5 -0.1109 0.02768 -4.006 9265 0.00006234 -0.1651 -0.05663
ran_pars mother_pidlink sd__(Intercept) 0.3956 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8692 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3527 0.1522 2.318 13861 0.02046 0.05448 0.651
fixed NA birth_order -0.002253 0.003393 -0.6641 13247 0.5066 -0.008902 0.004396
fixed NA poly(age, 3, raw = TRUE)1 0.006857 0.01463 0.4687 13801 0.6393 -0.02182 0.03553
fixed NA poly(age, 3, raw = TRUE)2 -0.0004838 0.0004315 -1.121 13642 0.2622 -0.00133 0.000362
fixed NA poly(age, 3, raw = TRUE)3 0.0000008756 0.000003978 0.2201 13467 0.8258 -0.000006921 0.000008673
fixed NA male -0.1025 0.01588 -6.457 13510 0.0000000001105 -0.1337 -0.07142
fixed NA sibling_count3 0.02891 0.03285 0.8802 9978 0.3788 -0.03547 0.09329
fixed NA sibling_count4 0.03031 0.034 0.8913 9240 0.3728 -0.03634 0.09695
fixed NA sibling_count5 -0.002406 0.03561 -0.06757 8434 0.9461 -0.0722 0.06738
fixed NA sibling_count>5 -0.1024 0.03047 -3.361 10417 0.0007793 -0.1621 -0.04269
ran_pars mother_pidlink sd__(Intercept) 0.3954 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8693 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3551 0.1526 2.327 13859 0.01998 0.05601 0.6541
fixed NA poly(age, 3, raw = TRUE)1 0.007002 0.01463 0.4784 13804 0.6324 -0.02168 0.03569
fixed NA poly(age, 3, raw = TRUE)2 -0.0004887 0.0004316 -1.132 13647 0.2575 -0.001335 0.0003572
fixed NA poly(age, 3, raw = TRUE)3 0.0000009008 0.00000398 0.2264 13462 0.8209 -0.000006899 0.000008701
fixed NA male -0.1025 0.01588 -6.451 13505 0.0000000001149 -0.1336 -0.07133
fixed NA sibling_count3 0.02886 0.03328 0.8672 10301 0.3859 -0.03637 0.09408
fixed NA sibling_count4 0.02953 0.0349 0.8461 9895 0.3975 -0.03887 0.09792
fixed NA sibling_count5 -0.00005737 0.03689 -0.001555 9291 0.9988 -0.07236 0.07224
fixed NA sibling_count>5 -0.09666 0.03193 -3.027 11404 0.002472 -0.1592 -0.03408
fixed NA birth_order_nonlinear2 -0.01544 0.02294 -0.6729 12530 0.501 -0.0604 0.02953
fixed NA birth_order_nonlinear3 -0.008737 0.02705 -0.323 12226 0.7467 -0.06175 0.04428
fixed NA birth_order_nonlinear4 -0.005941 0.03082 -0.1928 12252 0.8471 -0.06635 0.05446
fixed NA birth_order_nonlinear5 -0.03387 0.03506 -0.9661 12247 0.334 -0.1026 0.03485
fixed NA birth_order_nonlinear>5 -0.03147 0.02934 -1.073 13837 0.2834 -0.08897 0.02603
ran_pars mother_pidlink sd__(Intercept) 0.3954 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8694 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3423 0.1532 2.234 13851 0.02551 0.04197 0.6426
fixed NA poly(age, 3, raw = TRUE)1 0.007367 0.01464 0.5033 13793 0.6148 -0.02132 0.03606
fixed NA poly(age, 3, raw = TRUE)2 -0.0005014 0.0004317 -1.161 13630 0.2455 -0.001348 0.0003448
fixed NA poly(age, 3, raw = TRUE)3 0.000001029 0.000003981 0.2583 13437 0.7962 -0.000006775 0.000008832
fixed NA male -0.1027 0.01589 -6.463 13496 0.000000000106 -0.1338 -0.07155
fixed NA count_birth_order2/2 0.01152 0.04462 0.2582 12658 0.7963 -0.07594 0.09898
fixed NA count_birth_order1/3 0.03433 0.04294 0.7994 13632 0.4241 -0.04984 0.1185
fixed NA count_birth_order2/3 0.03836 0.04795 0.8002 13776 0.4236 -0.05561 0.1323
fixed NA count_birth_order3/3 0.01806 0.05364 0.3367 13878 0.7364 -0.08707 0.1232
fixed NA count_birth_order1/4 0.009683 0.04898 0.1977 13779 0.8433 -0.08632 0.1057
fixed NA count_birth_order2/4 0.06327 0.05141 1.231 13827 0.2185 -0.03749 0.164
fixed NA count_birth_order3/4 0.0178 0.0558 0.3189 13896 0.7498 -0.09158 0.1272
fixed NA count_birth_order4/4 0.04206 0.05908 0.7118 13918 0.4766 -0.07374 0.1579
fixed NA count_birth_order1/5 0.06302 0.05549 1.136 13874 0.2561 -0.04573 0.1718
fixed NA count_birth_order2/5 -0.05377 0.05819 -0.9241 13906 0.3554 -0.1678 0.06027
fixed NA count_birth_order3/5 -0.02803 0.05982 -0.4686 13919 0.6394 -0.1453 0.08922
fixed NA count_birth_order4/5 -0.007194 0.06332 -0.1136 13926 0.9095 -0.1313 0.1169
fixed NA count_birth_order5/5 0.007012 0.06469 0.1084 13924 0.9137 -0.1198 0.1338
fixed NA count_birth_order1/>5 -0.07213 0.0447 -1.614 13923 0.1066 -0.1597 0.01547
fixed NA count_birth_order2/>5 -0.135 0.04606 -2.931 13926 0.003388 -0.2253 -0.04471
fixed NA count_birth_order3/>5 -0.06838 0.04515 -1.514 13925 0.13 -0.1569 0.02012
fixed NA count_birth_order4/>5 -0.09254 0.04425 -2.091 13926 0.03652 -0.1793 -0.005813
fixed NA count_birth_order5/>5 -0.1312 0.04458 -2.943 13925 0.003258 -0.2185 -0.04381
fixed NA count_birth_order>5/>5 -0.1183 0.03526 -3.355 12476 0.0007951 -0.1874 -0.04921
ran_pars mother_pidlink sd__(Intercept) 0.3952 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8695 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 38025 38108 -19002 38003 NA NA NA
12 38027 38117 -19001 38003 0.4421 1 0.5061
16 38034 38154 -19001 38002 1.325 4 0.8572
26 38046 38242 -18997 37994 7.138 10 0.7124

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2703 0.4011 0.6739 5871 0.5004 -0.5158 1.056
fixed NA poly(age, 3, raw = TRUE)1 0.0125 0.04552 0.2745 5875 0.7837 -0.07672 0.1017
fixed NA poly(age, 3, raw = TRUE)2 -0.0003482 0.001625 -0.2144 5880 0.8303 -0.003532 0.002836
fixed NA poly(age, 3, raw = TRUE)3 0.000000429 0.0000184 0.02331 5886 0.9814 -0.00003564 0.00003649
fixed NA male -0.1315 0.02342 -5.616 5806 0.00000002042 -0.1774 -0.08563
fixed NA sibling_count3 0.03636 0.03708 0.9806 4374 0.3269 -0.03632 0.109
fixed NA sibling_count4 -0.08697 0.03999 -2.175 3878 0.02971 -0.1653 -0.008589
fixed NA sibling_count5 -0.1077 0.04571 -2.357 3490 0.01849 -0.1973 -0.01814
fixed NA sibling_count>5 -0.1732 0.04014 -4.315 3295 0.00001642 -0.2519 -0.09454
ran_pars mother_pidlink sd__(Intercept) 0.3506 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8393 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2706 0.4012 0.6746 5870 0.4999 -0.5157 1.057
fixed NA birth_order -0.0004093 0.007764 -0.05271 5876 0.958 -0.01563 0.01481
fixed NA poly(age, 3, raw = TRUE)1 0.01252 0.04552 0.2749 5874 0.7834 -0.07671 0.1017
fixed NA poly(age, 3, raw = TRUE)2 -0.0003483 0.001625 -0.2144 5879 0.8303 -0.003533 0.002836
fixed NA poly(age, 3, raw = TRUE)3 0.0000004136 0.0000184 0.02247 5884 0.9821 -0.00003566 0.00003649
fixed NA male -0.1315 0.02342 -5.614 5805 0.00000002065 -0.1774 -0.0856
fixed NA sibling_count3 0.03656 0.03728 0.9808 4381 0.3268 -0.0365 0.1096
fixed NA sibling_count4 -0.08649 0.04099 -2.11 3892 0.0349 -0.1668 -0.006159
fixed NA sibling_count5 -0.107 0.04802 -2.227 3582 0.02599 -0.2011 -0.01284
fixed NA sibling_count>5 -0.1717 0.04976 -3.45 3832 0.0005666 -0.2692 -0.07415
ran_pars mother_pidlink sd__(Intercept) 0.3506 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8393 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3012 0.4018 0.7496 5874 0.4535 -0.4863 1.089
fixed NA poly(age, 3, raw = TRUE)1 0.01015 0.04555 0.2228 5874 0.8237 -0.07912 0.09942
fixed NA poly(age, 3, raw = TRUE)2 -0.0002567 0.001626 -0.1579 5877 0.8745 -0.003443 0.002929
fixed NA poly(age, 3, raw = TRUE)3 -0.0000007896 0.00001842 -0.04287 5882 0.9658 -0.00003689 0.00003531
fixed NA male -0.1317 0.02342 -5.625 5799 0.0000000194 -0.1777 -0.08584
fixed NA sibling_count3 0.03149 0.03803 0.8279 4565 0.4077 -0.04305 0.106
fixed NA sibling_count4 -0.08309 0.04257 -1.952 4220 0.05101 -0.1665 0.0003424
fixed NA sibling_count5 -0.08576 0.05042 -1.701 4018 0.08907 -0.1846 0.01307
fixed NA sibling_count>5 -0.1567 0.05121 -3.06 4096 0.00223 -0.2571 -0.05632
fixed NA birth_order_nonlinear2 -0.03205 0.03018 -1.062 4910 0.2882 -0.0912 0.02709
fixed NA birth_order_nonlinear3 0.02066 0.03726 0.5544 5133 0.5793 -0.05237 0.09368
fixed NA birth_order_nonlinear4 -0.04889 0.04612 -1.06 5285 0.2891 -0.1393 0.0415
fixed NA birth_order_nonlinear5 -0.09808 0.05756 -1.704 5140 0.08844 -0.2109 0.01473
fixed NA birth_order_nonlinear>5 -0.00781 0.05794 -0.1348 5888 0.8928 -0.1214 0.1057
ran_pars mother_pidlink sd__(Intercept) 0.3513 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8389 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.326 0.4027 0.8094 5866 0.4183 -0.4633 1.115
fixed NA poly(age, 3, raw = TRUE)1 0.007183 0.04565 0.1573 5864 0.875 -0.08229 0.09665
fixed NA poly(age, 3, raw = TRUE)2 -0.0001525 0.00163 -0.09357 5868 0.9255 -0.003346 0.003041
fixed NA poly(age, 3, raw = TRUE)3 -0.00000193 0.00001846 -0.1045 5873 0.9167 -0.00003812 0.00003426
fixed NA male -0.1314 0.02344 -5.606 5788 0.00000002162 -0.1774 -0.08548
fixed NA count_birth_order2/2 -0.02869 0.05464 -0.5251 5190 0.5995 -0.1358 0.0784
fixed NA count_birth_order1/3 0.03888 0.04861 0.7998 5867 0.4239 -0.0564 0.1342
fixed NA count_birth_order2/3 0.0252 0.05306 0.475 5899 0.6348 -0.0788 0.1292
fixed NA count_birth_order3/3 0.006071 0.05925 0.1025 5908 0.9184 -0.1101 0.1222
fixed NA count_birth_order1/4 -0.09194 0.05943 -1.547 5893 0.1219 -0.2084 0.02455
fixed NA count_birth_order2/4 -0.1157 0.0614 -1.883 5908 0.05968 -0.236 0.004696
fixed NA count_birth_order3/4 -0.0483 0.06482 -0.7451 5902 0.4562 -0.1754 0.07875
fixed NA count_birth_order4/4 -0.1287 0.06748 -1.907 5900 0.05655 -0.261 0.003563
fixed NA count_birth_order1/5 -0.1045 0.08064 -1.296 5907 0.1951 -0.2625 0.05355
fixed NA count_birth_order2/5 -0.07683 0.08625 -0.8907 5883 0.3731 -0.2459 0.09223
fixed NA count_birth_order3/5 -0.06136 0.08085 -0.7589 5884 0.4479 -0.2198 0.09711
fixed NA count_birth_order4/5 -0.1804 0.0779 -2.316 5895 0.02059 -0.3331 -0.02774
fixed NA count_birth_order5/5 -0.1471 0.08104 -1.816 5882 0.06946 -0.306 0.01169
fixed NA count_birth_order1/>5 -0.1353 0.07997 -1.692 5896 0.09067 -0.2921 0.02142
fixed NA count_birth_order2/>5 -0.2916 0.07915 -3.684 5884 0.0002313 -0.4467 -0.1365
fixed NA count_birth_order3/>5 -0.06251 0.07924 -0.7889 5857 0.4302 -0.2178 0.09279
fixed NA count_birth_order4/>5 -0.1658 0.07465 -2.221 5854 0.02637 -0.3121 -0.01951
fixed NA count_birth_order5/>5 -0.2781 0.07055 -3.942 5858 0.00008161 -0.4164 -0.1399
fixed NA count_birth_order>5/>5 -0.1635 0.05347 -3.058 5448 0.002235 -0.2683 -0.05874
ran_pars mother_pidlink sd__(Intercept) 0.3506 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8395 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15660 15733 -7819 15638 NA NA NA
12 15662 15742 -7819 15638 0.002809 1 0.9577
16 15664 15771 -7816 15632 6.129 4 0.1897
26 15677 15851 -7813 15625 6.632 10 0.7597

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3023 0.4002 0.7553 5922 0.4501 -0.4821 1.087
fixed NA poly(age, 3, raw = TRUE)1 0.00985 0.04544 0.2168 5925 0.8284 -0.0792 0.0989
fixed NA poly(age, 3, raw = TRUE)2 -0.0002896 0.001622 -0.1786 5930 0.8583 -0.003469 0.00289
fixed NA poly(age, 3, raw = TRUE)3 -0.0000002249 0.00001838 -0.01224 5936 0.9902 -0.00003624 0.00003579
fixed NA male -0.1318 0.02335 -5.645 5854 0.00000001732 -0.1775 -0.08603
fixed NA sibling_count3 0.03106 0.04014 0.7739 4530 0.439 -0.04761 0.1097
fixed NA sibling_count4 -0.06748 0.04232 -1.595 4143 0.1109 -0.1504 0.01547
fixed NA sibling_count5 -0.05013 0.04535 -1.105 3744 0.269 -0.139 0.03875
fixed NA sibling_count>5 -0.1294 0.03973 -3.257 3867 0.001135 -0.2073 -0.05154
ran_pars mother_pidlink sd__(Intercept) 0.3519 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8397 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3119 0.4003 0.7792 5921 0.4359 -0.4726 1.096
fixed NA birth_order -0.008494 0.00679 -1.251 5774 0.211 -0.0218 0.004814
fixed NA poly(age, 3, raw = TRUE)1 0.009959 0.04544 0.2192 5924 0.8265 -0.07909 0.09901
fixed NA poly(age, 3, raw = TRUE)2 -0.0002798 0.001622 -0.1725 5928 0.8631 -0.003459 0.002899
fixed NA poly(age, 3, raw = TRUE)3 -0.0000006759 0.00001838 -0.03678 5935 0.9707 -0.0000367 0.00003534
fixed NA male -0.1315 0.02335 -5.631 5853 0.00000001873 -0.1772 -0.08571
fixed NA sibling_count3 0.03519 0.04027 0.8737 4530 0.3823 -0.04375 0.1141
fixed NA sibling_count4 -0.05807 0.04298 -1.351 4137 0.1767 -0.1423 0.02617
fixed NA sibling_count5 -0.03529 0.04687 -0.7529 3767 0.4515 -0.1272 0.05658
fixed NA sibling_count>5 -0.09817 0.04692 -2.092 4181 0.03648 -0.1901 -0.006204
ran_pars mother_pidlink sd__(Intercept) 0.3517 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8398 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3142 0.4008 0.7839 5924 0.4331 -0.4713 1.1
fixed NA poly(age, 3, raw = TRUE)1 0.009226 0.04545 0.203 5923 0.8392 -0.07986 0.09831
fixed NA poly(age, 3, raw = TRUE)2 -0.0002426 0.001623 -0.1495 5927 0.8812 -0.003423 0.002938
fixed NA poly(age, 3, raw = TRUE)3 -0.000001365 0.00001839 -0.07425 5932 0.9408 -0.00003741 0.00003468
fixed NA male -0.1316 0.02335 -5.636 5847 0.00000001818 -0.1774 -0.08583
fixed NA sibling_count3 0.03017 0.04099 0.7361 4682 0.4617 -0.05017 0.1105
fixed NA sibling_count4 -0.05283 0.04447 -1.188 4420 0.235 -0.14 0.03434
fixed NA sibling_count5 -0.02045 0.04908 -0.4166 4158 0.677 -0.1167 0.07576
fixed NA sibling_count>5 -0.07574 0.04836 -1.566 4456 0.1174 -0.1705 0.01904
fixed NA birth_order_nonlinear2 -0.02291 0.03076 -0.7446 5045 0.4566 -0.0832 0.03739
fixed NA birth_order_nonlinear3 0.00622 0.03718 0.1673 5257 0.8671 -0.06665 0.07909
fixed NA birth_order_nonlinear4 -0.07617 0.04479 -1.701 5413 0.08908 -0.164 0.01162
fixed NA birth_order_nonlinear5 -0.09325 0.05494 -1.697 5348 0.08968 -0.2009 0.01442
fixed NA birth_order_nonlinear>5 -0.09131 0.05184 -1.761 5969 0.07821 -0.1929 0.01029
ran_pars mother_pidlink sd__(Intercept) 0.353 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8392 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3186 0.4016 0.7935 5918 0.4275 -0.4684 1.106
fixed NA poly(age, 3, raw = TRUE)1 0.00678 0.04552 0.1489 5915 0.8816 -0.08245 0.096
fixed NA poly(age, 3, raw = TRUE)2 -0.0001478 0.001626 -0.09093 5920 0.9275 -0.003334 0.003038
fixed NA poly(age, 3, raw = TRUE)3 -0.000002497 0.00001842 -0.1355 5925 0.8922 -0.00003861 0.00003361
fixed NA male -0.1314 0.02337 -5.623 5839 0.00000001967 -0.1772 -0.08558
fixed NA count_birth_order2/2 0.02163 0.05991 0.361 5313 0.7181 -0.09579 0.139
fixed NA count_birth_order1/3 0.05145 0.05267 0.9768 5919 0.3287 -0.05178 0.1547
fixed NA count_birth_order2/3 0.03833 0.05711 0.6712 5948 0.5021 -0.0736 0.1503
fixed NA count_birth_order3/3 0.01506 0.06423 0.2345 5959 0.8146 -0.1108 0.1409
fixed NA count_birth_order1/4 -0.06686 0.06228 -1.073 5944 0.2831 -0.1889 0.05522
fixed NA count_birth_order2/4 -0.05847 0.06323 -0.9247 5957 0.3552 -0.1824 0.06546
fixed NA count_birth_order3/4 -0.03496 0.06945 -0.5034 5954 0.6147 -0.1711 0.1012
fixed NA count_birth_order4/4 -0.06921 0.07172 -0.965 5953 0.3346 -0.2098 0.07136
fixed NA count_birth_order1/5 0.02871 0.07388 0.3886 5958 0.6976 -0.1161 0.1735
fixed NA count_birth_order2/5 0.0003236 0.07927 0.004082 5948 0.9967 -0.155 0.1557
fixed NA count_birth_order3/5 -0.009014 0.07708 -0.1169 5946 0.9069 -0.1601 0.1421
fixed NA count_birth_order4/5 -0.09693 0.07987 -1.214 5934 0.225 -0.2535 0.05961
fixed NA count_birth_order5/5 -0.1483 0.08009 -1.851 5934 0.06419 -0.3052 0.008712
fixed NA count_birth_order1/>5 -0.02559 0.07021 -0.3644 5959 0.7156 -0.1632 0.112
fixed NA count_birth_order2/>5 -0.1887 0.07328 -2.575 5944 0.01004 -0.3324 -0.04509
fixed NA count_birth_order3/>5 0.00315 0.07175 0.04391 5932 0.965 -0.1375 0.1438
fixed NA count_birth_order4/>5 -0.1667 0.06916 -2.41 5931 0.01597 -0.3023 -0.03115
fixed NA count_birth_order5/>5 -0.1191 0.07104 -1.676 5900 0.09374 -0.2583 0.02015
fixed NA count_birth_order>5/>5 -0.1524 0.0524 -2.909 5556 0.003643 -0.2551 -0.04972
ran_pars mother_pidlink sd__(Intercept) 0.3507 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8402 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15806 15880 -7892 15784 NA NA NA
12 15807 15887 -7891 15783 1.568 1 0.2105
16 15810 15917 -7889 15778 5.324 4 0.2556
26 15821 15996 -7885 15769 8.136 10 0.6156

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2817 0.4058 0.6942 5753 0.4876 -0.5136 1.077
fixed NA poly(age, 3, raw = TRUE)1 0.0102 0.04607 0.2214 5757 0.8248 -0.08009 0.1005
fixed NA poly(age, 3, raw = TRUE)2 -0.0002244 0.001645 -0.1364 5761 0.8915 -0.003448 0.002999
fixed NA poly(age, 3, raw = TRUE)3 -0.000001458 0.00001864 -0.0782 5767 0.9377 -0.00003799 0.00003507
fixed NA male -0.127 0.02366 -5.368 5688 0.00000008287 -0.1734 -0.08062
fixed NA sibling_count3 0.01622 0.03661 0.443 4282 0.6578 -0.05554 0.08798
fixed NA sibling_count4 -0.08336 0.03974 -2.098 3812 0.03597 -0.1612 -0.005483
fixed NA sibling_count5 -0.1066 0.04688 -2.274 3333 0.02303 -0.1985 -0.01472
fixed NA sibling_count>5 -0.1814 0.04062 -4.467 3144 0.000008212 -0.261 -0.1018
ran_pars mother_pidlink sd__(Intercept) 0.3519 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8386 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2826 0.4058 0.6965 5752 0.4862 -0.5128 1.078
fixed NA birth_order -0.001434 0.007998 -0.1793 5778 0.8577 -0.01711 0.01424
fixed NA poly(age, 3, raw = TRUE)1 0.01029 0.04608 0.2234 5756 0.8232 -0.08001 0.1006
fixed NA poly(age, 3, raw = TRUE)2 -0.0002252 0.001645 -0.1369 5760 0.8911 -0.003449 0.002999
fixed NA poly(age, 3, raw = TRUE)3 -0.000001507 0.00001864 -0.08082 5765 0.9356 -0.00003805 0.00003503
fixed NA male -0.127 0.02366 -5.365 5687 0.00000008392 -0.1733 -0.08058
fixed NA sibling_count3 0.01692 0.03683 0.4595 4287 0.6459 -0.05525 0.0891
fixed NA sibling_count4 -0.08173 0.04077 -2.005 3838 0.04508 -0.1616 -0.001818
fixed NA sibling_count5 -0.104 0.04907 -2.12 3420 0.03411 -0.2002 -0.007835
fixed NA sibling_count>5 -0.1761 0.05051 -3.486 3773 0.0004965 -0.2751 -0.07706
ran_pars mother_pidlink sd__(Intercept) 0.3519 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8387 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3087 0.4063 0.7598 5755 0.4474 -0.4876 1.105
fixed NA poly(age, 3, raw = TRUE)1 0.008334 0.04608 0.1809 5754 0.8565 -0.08199 0.09866
fixed NA poly(age, 3, raw = TRUE)2 -0.0001465 0.001645 -0.08904 5757 0.9291 -0.003371 0.003078
fixed NA poly(age, 3, raw = TRUE)3 -0.000002585 0.00001865 -0.1386 5761 0.8898 -0.00003914 0.00003397
fixed NA male -0.1268 0.02365 -5.361 5678 0.00000008592 -0.1732 -0.08045
fixed NA sibling_count3 0.007929 0.03761 0.2108 4468 0.833 -0.06578 0.08164
fixed NA sibling_count4 -0.08449 0.04241 -1.992 4162 0.04639 -0.1676 -0.001375
fixed NA sibling_count5 -0.08849 0.05131 -1.724 3804 0.08471 -0.1891 0.01209
fixed NA sibling_count>5 -0.1624 0.05206 -3.12 4052 0.001822 -0.2644 -0.06038
fixed NA birth_order_nonlinear2 -0.03418 0.03009 -1.136 4792 0.2561 -0.09315 0.0248
fixed NA birth_order_nonlinear3 0.03246 0.03725 0.8714 4995 0.3836 -0.04054 0.1055
fixed NA birth_order_nonlinear4 -0.04026 0.04743 -0.8487 5143 0.3961 -0.1332 0.05271
fixed NA birth_order_nonlinear5 -0.1089 0.06002 -1.814 5024 0.06979 -0.2265 0.008782
fixed NA birth_order_nonlinear>5 -0.01919 0.05976 -0.3212 5744 0.7481 -0.1363 0.09792
ran_pars mother_pidlink sd__(Intercept) 0.3542 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8375 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3267 0.4074 0.8019 5748 0.4226 -0.4718 1.125
fixed NA poly(age, 3, raw = TRUE)1 0.006268 0.04621 0.1357 5746 0.8921 -0.08429 0.09683
fixed NA poly(age, 3, raw = TRUE)2 -0.00007614 0.00165 -0.04615 5749 0.9632 -0.00331 0.003158
fixed NA poly(age, 3, raw = TRUE)3 -0.000003334 0.0000187 -0.1783 5754 0.8585 -0.00003999 0.00003333
fixed NA male -0.1272 0.02368 -5.373 5667 0.00000008065 -0.1736 -0.08082
fixed NA count_birth_order2/2 -0.03157 0.05319 -0.5935 5032 0.5529 -0.1358 0.07268
fixed NA count_birth_order1/3 0.00815 0.04803 0.1697 5748 0.8653 -0.08598 0.1023
fixed NA count_birth_order2/3 -0.003243 0.05303 -0.06115 5784 0.9512 -0.1072 0.1007
fixed NA count_birth_order3/3 0.01332 0.0582 0.2289 5789 0.8189 -0.1007 0.1274
fixed NA count_birth_order1/4 -0.07328 0.05972 -1.227 5780 0.2198 -0.1903 0.04377
fixed NA count_birth_order2/4 -0.1149 0.0613 -1.874 5789 0.06101 -0.235 0.005281
fixed NA count_birth_order3/4 -0.05864 0.06415 -0.9141 5781 0.3607 -0.1844 0.06709
fixed NA count_birth_order4/4 -0.1343 0.06788 -1.978 5774 0.04795 -0.2673 -0.001241
fixed NA count_birth_order1/5 -0.112 0.08048 -1.391 5789 0.1642 -0.2697 0.04577
fixed NA count_birth_order2/5 -0.09691 0.08883 -1.091 5757 0.2753 -0.271 0.07719
fixed NA count_birth_order3/5 -0.05437 0.08475 -0.6416 5757 0.5212 -0.2205 0.1117
fixed NA count_birth_order4/5 -0.1419 0.08168 -1.738 5771 0.08234 -0.302 0.01816
fixed NA count_birth_order5/5 -0.174 0.08675 -2.006 5757 0.04491 -0.344 -0.003991
fixed NA count_birth_order1/>5 -0.1511 0.08185 -1.846 5771 0.065 -0.3115 0.009357
fixed NA count_birth_order2/>5 -0.2914 0.08114 -3.591 5759 0.0003317 -0.4504 -0.1324
fixed NA count_birth_order3/>5 -0.05562 0.08034 -0.6923 5731 0.4888 -0.2131 0.1019
fixed NA count_birth_order4/>5 -0.1748 0.07855 -2.226 5705 0.02606 -0.3288 -0.02089
fixed NA count_birth_order5/>5 -0.2837 0.07222 -3.929 5730 0.00008646 -0.4253 -0.1422
fixed NA count_birth_order>5/>5 -0.1808 0.05448 -3.319 5307 0.0009102 -0.2876 -0.07403
ran_pars mother_pidlink sd__(Intercept) 0.3538 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8382 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15343 15417 -7661 15321 NA NA NA
12 15345 15425 -7661 15321 0.03222 1 0.8575
16 15346 15453 -7657 15314 7.259 4 0.1228
26 15362 15535 -7655 15310 4.273 10 0.9342

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Delayed word recall

birthorder <- birthorder %>% mutate(outcome = words_delayed)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.309 0.1522 2.03 13839 0.04237 0.01067 0.6073
fixed NA poly(age, 3, raw = TRUE)1 0.01178 0.0146 0.8074 13779 0.4194 -0.01682 0.04039
fixed NA poly(age, 3, raw = TRUE)2 -0.0006651 0.0004297 -1.548 13646 0.1217 -0.001507 0.0001771
fixed NA poly(age, 3, raw = TRUE)3 0.000001695 0.00000396 0.4279 13487 0.6687 -0.000006066 0.000009455
fixed NA male -0.07984 0.01592 -5.015 13572 0.0000005358 -0.111 -0.04864
fixed NA sibling_count3 0.05182 0.03269 1.585 10021 0.113 -0.01226 0.1159
fixed NA sibling_count4 0.03874 0.03375 1.148 9202 0.2511 -0.02741 0.1049
fixed NA sibling_count5 0.007162 0.03517 0.2037 8305 0.8386 -0.06176 0.07609
fixed NA sibling_count>5 -0.06697 0.02754 -2.432 9296 0.01505 -0.1209 -0.01299
ran_pars mother_pidlink sd__(Intercept) 0.3767 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8767 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3084 0.1522 2.026 13839 0.04274 0.01012 0.6068
fixed NA birth_order -0.001883 0.003389 -0.5557 13060 0.5784 -0.008525 0.004759
fixed NA poly(age, 3, raw = TRUE)1 0.01235 0.01463 0.8444 13767 0.3985 -0.01632 0.04103
fixed NA poly(age, 3, raw = TRUE)2 -0.0006861 0.0004314 -1.591 13594 0.1117 -0.001532 0.0001594
fixed NA poly(age, 3, raw = TRUE)3 0.00000189 0.000003975 0.4754 13410 0.6345 -0.000005902 0.000009681
fixed NA male -0.07979 0.01592 -5.012 13571 0.0000005458 -0.111 -0.04858
fixed NA sibling_count3 0.05222 0.0327 1.597 10038 0.1103 -0.01188 0.1163
fixed NA sibling_count4 0.04001 0.03383 1.183 9270 0.2369 -0.02629 0.1063
fixed NA sibling_count5 0.00941 0.0354 0.2658 8426 0.7904 -0.05997 0.07879
fixed NA sibling_count>5 -0.05988 0.03035 -1.973 10433 0.04853 -0.1194 -0.0003944
ran_pars mother_pidlink sd__(Intercept) 0.3766 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8767 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3002 0.1526 1.967 13838 0.04921 0.001069 0.5993
fixed NA poly(age, 3, raw = TRUE)1 0.01267 0.01463 0.8656 13771 0.3867 -0.01602 0.04135
fixed NA poly(age, 3, raw = TRUE)2 -0.0007038 0.0004314 -1.631 13599 0.1029 -0.001549 0.0001418
fixed NA poly(age, 3, raw = TRUE)3 0.000002105 0.000003976 0.5294 13405 0.5966 -0.000005689 0.000009899
fixed NA male -0.07975 0.01592 -5.009 13568 0.0000005541 -0.111 -0.04854
fixed NA sibling_count3 0.054 0.03314 1.63 10368 0.1032 -0.01095 0.119
fixed NA sibling_count4 0.03784 0.03474 1.089 9942 0.276 -0.03024 0.1059
fixed NA sibling_count5 0.00649 0.03669 0.1769 9307 0.8596 -0.06543 0.07841
fixed NA sibling_count>5 -0.05398 0.03183 -1.696 11448 0.08992 -0.1164 0.008402
fixed NA birth_order_nonlinear2 0.01565 0.02303 0.6794 12559 0.4969 -0.02949 0.06078
fixed NA birth_order_nonlinear3 -0.008068 0.02716 -0.2971 12278 0.7664 -0.0613 0.04516
fixed NA birth_order_nonlinear4 0.01986 0.03094 0.6418 12316 0.521 -0.04079 0.08051
fixed NA birth_order_nonlinear5 0.005391 0.0352 0.1531 12321 0.8783 -0.06361 0.07439
fixed NA birth_order_nonlinear>5 -0.02652 0.02938 -0.9024 13865 0.3668 -0.0841 0.03107
ran_pars mother_pidlink sd__(Intercept) 0.3763 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8769 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2999 0.1533 1.957 13832 0.0504 -0.0005013 0.6003
fixed NA poly(age, 3, raw = TRUE)1 0.0129 0.01464 0.8813 13762 0.3782 -0.01579 0.04159
fixed NA poly(age, 3, raw = TRUE)2 -0.0007085 0.0004316 -1.642 13584 0.1007 -0.001554 0.0001374
fixed NA poly(age, 3, raw = TRUE)3 0.000002131 0.000003979 0.5357 13382 0.5922 -0.000005667 0.000009929
fixed NA male -0.07974 0.01593 -5.007 13556 0.0000005593 -0.111 -0.04853
fixed NA count_birth_order2/2 0.008045 0.04478 0.1796 12640 0.8574 -0.07973 0.09582
fixed NA count_birth_order1/3 0.06475 0.04293 1.508 13673 0.1315 -0.01939 0.1489
fixed NA count_birth_order2/3 0.05148 0.04795 1.074 13795 0.283 -0.0425 0.1455
fixed NA count_birth_order3/3 0.03626 0.05366 0.6757 13884 0.4992 -0.06891 0.1414
fixed NA count_birth_order1/4 0.006214 0.04899 0.1268 13799 0.8991 -0.0898 0.1022
fixed NA count_birth_order2/4 0.1041 0.05142 2.024 13840 0.04303 0.003272 0.2048
fixed NA count_birth_order3/4 0.02208 0.05583 0.3954 13899 0.6925 -0.08735 0.1315
fixed NA count_birth_order4/4 0.03046 0.05912 0.5152 13919 0.6064 -0.08542 0.1463
fixed NA count_birth_order1/5 -0.04227 0.05551 -0.7614 13882 0.4464 -0.1511 0.06654
fixed NA count_birth_order2/5 0.02579 0.05822 0.4429 13909 0.6578 -0.08833 0.1399
fixed NA count_birth_order3/5 -0.005886 0.05987 -0.09831 13920 0.9217 -0.1232 0.1115
fixed NA count_birth_order4/5 0.03416 0.06337 0.539 13926 0.5899 -0.09005 0.1584
fixed NA count_birth_order5/5 0.06224 0.06476 0.9611 13924 0.3365 -0.06468 0.1892
fixed NA count_birth_order1/>5 -0.03199 0.04473 -0.7153 13923 0.4745 -0.1197 0.05568
fixed NA count_birth_order2/>5 -0.06433 0.0461 -1.395 13926 0.1629 -0.1547 0.02603
fixed NA count_birth_order3/>5 -0.058 0.0452 -1.283 13925 0.1995 -0.1466 0.03059
fixed NA count_birth_order4/>5 -0.03051 0.04429 -0.6888 13926 0.491 -0.1173 0.0563
fixed NA count_birth_order5/>5 -0.06936 0.04462 -1.554 13925 0.1201 -0.1568 0.0181
fixed NA count_birth_order>5/>5 -0.08347 0.0352 -2.372 12499 0.01773 -0.1525 -0.01449
ran_pars mother_pidlink sd__(Intercept) 0.3767 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8769 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 38051 38134 -19015 38029 NA NA NA
12 38053 38143 -19014 38029 0.3095 1 0.578
16 38058 38179 -19013 38026 2.904 4 0.574
26 38072 38268 -19010 38020 6.247 10 0.7941

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5229 0.4116 1.27 5873 0.204 -0.2838 1.33
fixed NA poly(age, 3, raw = TRUE)1 -0.01788 0.04671 -0.3827 5877 0.7019 -0.1094 0.07368
fixed NA poly(age, 3, raw = TRUE)2 0.0007731 0.001667 0.4637 5882 0.6429 -0.002495 0.004041
fixed NA poly(age, 3, raw = TRUE)3 -0.00001439 0.00001888 -0.762 5888 0.4461 -0.0000514 0.00002262
fixed NA male -0.115 0.02403 -4.784 5811 0.000001765 -0.1621 -0.06786
fixed NA sibling_count3 0.0267 0.03804 0.7019 4409 0.4828 -0.04786 0.1013
fixed NA sibling_count4 -0.04166 0.04102 -1.016 3917 0.3098 -0.1221 0.03873
fixed NA sibling_count5 -0.06095 0.04688 -1.3 3531 0.1937 -0.1528 0.03094
fixed NA sibling_count>5 -0.09835 0.04118 -2.388 3335 0.01698 -0.179 -0.01764
ran_pars mother_pidlink sd__(Intercept) 0.3583 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8618 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5171 0.4117 1.256 5872 0.2091 -0.2897 1.324
fixed NA birth_order 0.007062 0.007967 0.8865 5876 0.3754 -0.008552 0.02268
fixed NA poly(age, 3, raw = TRUE)1 -0.01823 0.04672 -0.3902 5877 0.6964 -0.1098 0.07333
fixed NA poly(age, 3, raw = TRUE)2 0.0007744 0.001667 0.4645 5881 0.6423 -0.002493 0.004042
fixed NA poly(age, 3, raw = TRUE)3 -0.00001412 0.00001889 -0.7477 5886 0.4547 -0.00005114 0.00002289
fixed NA male -0.1153 0.02404 -4.796 5810 0.000001657 -0.1624 -0.06818
fixed NA sibling_count3 0.02326 0.03824 0.6082 4415 0.5431 -0.05169 0.09821
fixed NA sibling_count4 -0.04983 0.04204 -1.185 3930 0.236 -0.1322 0.03258
fixed NA sibling_count5 -0.07432 0.04925 -1.509 3621 0.1314 -0.1709 0.02221
fixed NA sibling_count>5 -0.1251 0.05104 -2.451 3868 0.0143 -0.2251 -0.02505
ran_pars mother_pidlink sd__(Intercept) 0.3584 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8618 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.519 0.4125 1.258 5877 0.2084 -0.2896 1.327
fixed NA poly(age, 3, raw = TRUE)1 -0.01781 0.04676 -0.3809 5877 0.7033 -0.1095 0.07385
fixed NA poly(age, 3, raw = TRUE)2 0.0007623 0.001669 0.4567 5881 0.6479 -0.002509 0.004034
fixed NA poly(age, 3, raw = TRUE)3 -0.00001408 0.00001891 -0.7446 5885 0.4565 -0.00005114 0.00002298
fixed NA male -0.115 0.02405 -4.78 5806 0.000001797 -0.1621 -0.06782
fixed NA sibling_count3 0.02667 0.03902 0.6834 4598 0.4944 -0.04981 0.1031
fixed NA sibling_count4 -0.04087 0.04367 -0.9359 4255 0.3494 -0.1265 0.04472
fixed NA sibling_count5 -0.05821 0.05172 -1.125 4052 0.2605 -0.1596 0.04317
fixed NA sibling_count>5 -0.1119 0.05254 -2.13 4127 0.03319 -0.2149 -0.008957
fixed NA birth_order_nonlinear2 0.01206 0.031 0.3889 4938 0.6973 -0.0487 0.07281
fixed NA birth_order_nonlinear3 0.0001107 0.03827 0.002894 5157 0.9977 -0.07489 0.07512
fixed NA birth_order_nonlinear4 -0.003256 0.04736 -0.06875 5306 0.9452 -0.09609 0.08958
fixed NA birth_order_nonlinear5 -0.004436 0.05912 -0.07503 5167 0.9402 -0.1203 0.1114
fixed NA birth_order_nonlinear>5 0.04355 0.05949 0.7321 5892 0.4641 -0.07304 0.1601
ran_pars mother_pidlink sd__(Intercept) 0.3573 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8625 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5809 0.4133 1.406 5869 0.1599 -0.2291 1.391
fixed NA poly(age, 3, raw = TRUE)1 -0.02288 0.04685 -0.4885 5868 0.6252 -0.1147 0.06894
fixed NA poly(age, 3, raw = TRUE)2 0.0009401 0.001672 0.5622 5872 0.574 -0.002338 0.004218
fixed NA poly(age, 3, raw = TRUE)3 -0.00001602 0.00001895 -0.8455 5877 0.3978 -0.00005316 0.00002112
fixed NA male -0.115 0.02406 -4.778 5796 0.000001813 -0.1621 -0.06781
fixed NA count_birth_order2/2 -0.03987 0.0561 -0.7107 5209 0.4773 -0.1498 0.07008
fixed NA count_birth_order1/3 0.01812 0.04988 0.3633 5870 0.7164 -0.07964 0.1159
fixed NA count_birth_order2/3 0.03543 0.05445 0.6507 5900 0.5153 -0.07129 0.1422
fixed NA count_birth_order3/3 -0.0276 0.06081 -0.4539 5908 0.6499 -0.1468 0.09158
fixed NA count_birth_order1/4 -0.09582 0.06099 -1.571 5894 0.1162 -0.2154 0.02371
fixed NA count_birth_order2/4 0.009069 0.06301 0.1439 5908 0.8856 -0.1144 0.1326
fixed NA count_birth_order3/4 -0.06621 0.06652 -0.9952 5903 0.3197 -0.1966 0.06418
fixed NA count_birth_order4/4 -0.06907 0.06925 -0.9974 5900 0.3186 -0.2048 0.06666
fixed NA count_birth_order1/5 -0.1395 0.08275 -1.686 5907 0.09183 -0.3017 0.02266
fixed NA count_birth_order2/5 -0.03975 0.08852 -0.4491 5884 0.6534 -0.2132 0.1337
fixed NA count_birth_order3/5 -0.08459 0.08298 -1.019 5885 0.308 -0.2472 0.07805
fixed NA count_birth_order4/5 -0.1223 0.07995 -1.53 5895 0.1261 -0.279 0.03438
fixed NA count_birth_order5/5 0.02383 0.08317 0.2865 5884 0.7745 -0.1392 0.1868
fixed NA count_birth_order1/>5 -0.1065 0.08207 -1.298 5897 0.1944 -0.2674 0.05433
fixed NA count_birth_order2/>5 -0.199 0.08123 -2.45 5886 0.0143 -0.3582 -0.03983
fixed NA count_birth_order3/>5 -0.03194 0.08132 -0.3928 5860 0.6945 -0.1913 0.1274
fixed NA count_birth_order4/>5 -0.08364 0.07662 -1.092 5857 0.275 -0.2338 0.06653
fixed NA count_birth_order5/>5 -0.2049 0.0724 -2.831 5861 0.004662 -0.3469 -0.06304
fixed NA count_birth_order>5/>5 -0.08616 0.05485 -1.571 5455 0.1163 -0.1937 0.02135
ran_pars mother_pidlink sd__(Intercept) 0.3559 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8628 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15967 16040 -7972 15945 NA NA NA
12 15968 16048 -7972 15944 0.7869 1 0.375
16 15976 16083 -7972 15944 0.1261 4 0.9981
26 15984 16158 -7966 15932 11.94 10 0.2889

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5618 0.4105 1.368 5925 0.1712 -0.2428 1.366
fixed NA poly(age, 3, raw = TRUE)1 -0.02052 0.04661 -0.4403 5928 0.6597 -0.1119 0.07083
fixed NA poly(age, 3, raw = TRUE)2 0.0008411 0.001664 0.5055 5933 0.6132 -0.00242 0.004102
fixed NA poly(age, 3, raw = TRUE)3 -0.0000151 0.00001885 -0.801 5939 0.4231 -0.00005204 0.00002184
fixed NA male -0.117 0.02395 -4.887 5859 0.000001049 -0.164 -0.07011
fixed NA sibling_count3 0.01493 0.04115 0.3629 4565 0.7167 -0.06573 0.09559
fixed NA sibling_count4 -0.04601 0.04339 -1.061 4182 0.289 -0.131 0.03902
fixed NA sibling_count5 -0.007199 0.04649 -0.1548 3785 0.877 -0.09832 0.08392
fixed NA sibling_count>5 -0.08743 0.04073 -2.147 3907 0.03189 -0.1673 -0.007599
ran_pars mother_pidlink sd__(Intercept) 0.3588 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8621 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5616 0.4106 1.368 5924 0.1715 -0.2432 1.366
fixed NA birth_order 0.000166 0.006964 0.02383 5775 0.981 -0.01348 0.01382
fixed NA poly(age, 3, raw = TRUE)1 -0.02052 0.04661 -0.4403 5927 0.6598 -0.1119 0.07084
fixed NA poly(age, 3, raw = TRUE)2 0.0008408 0.001664 0.5053 5931 0.6134 -0.002421 0.004102
fixed NA poly(age, 3, raw = TRUE)3 -0.00001509 0.00001885 -0.8003 5937 0.4236 -0.00005204 0.00002186
fixed NA male -0.1171 0.02395 -4.887 5859 0.000001052 -0.164 -0.07011
fixed NA sibling_count3 0.01485 0.0413 0.3596 4565 0.7191 -0.06609 0.09579
fixed NA sibling_count4 -0.0462 0.04407 -1.048 4175 0.2946 -0.1326 0.04018
fixed NA sibling_count5 -0.007488 0.04806 -0.1558 3807 0.8762 -0.1017 0.08671
fixed NA sibling_count>5 -0.08804 0.04811 -1.83 4216 0.06735 -0.1823 0.006261
ran_pars mother_pidlink sd__(Intercept) 0.3589 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8622 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5356 0.4112 1.302 5927 0.1928 -0.2704 1.342
fixed NA poly(age, 3, raw = TRUE)1 -0.01871 0.04664 -0.4011 5927 0.6883 -0.1101 0.07271
fixed NA poly(age, 3, raw = TRUE)2 0.0007845 0.001665 0.4711 5930 0.6376 -0.002479 0.004048
fixed NA poly(age, 3, raw = TRUE)3 -0.00001472 0.00001887 -0.7799 5936 0.4355 -0.0000517 0.00002227
fixed NA male -0.1163 0.02396 -4.853 5854 0.000001246 -0.1632 -0.06932
fixed NA sibling_count3 0.01644 0.04204 0.3912 4716 0.6957 -0.06595 0.09883
fixed NA sibling_count4 -0.03607 0.0456 -0.7909 4457 0.4291 -0.1254 0.05331
fixed NA sibling_count5 0.00655 0.05033 0.1302 4196 0.8965 -0.09209 0.1052
fixed NA sibling_count>5 -0.05999 0.04958 -1.21 4489 0.2264 -0.1572 0.03719
fixed NA birth_order_nonlinear2 0.03067 0.03158 0.9712 5073 0.3315 -0.03123 0.09257
fixed NA birth_order_nonlinear3 -0.00388 0.03816 -0.1017 5281 0.919 -0.07868 0.07092
fixed NA birth_order_nonlinear4 -0.03289 0.04598 -0.7153 5434 0.4745 -0.123 0.05723
fixed NA birth_order_nonlinear5 -0.004899 0.05639 -0.08687 5371 0.9308 -0.1154 0.1056
fixed NA birth_order_nonlinear>5 -0.03593 0.05319 -0.6756 5969 0.4993 -0.1402 0.06831
ran_pars mother_pidlink sd__(Intercept) 0.359 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8622 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5631 0.4121 1.366 5921 0.1719 -0.2447 1.371
fixed NA poly(age, 3, raw = TRUE)1 -0.02195 0.04672 -0.4699 5918 0.6384 -0.1135 0.06962
fixed NA poly(age, 3, raw = TRUE)2 0.0009012 0.001668 0.5401 5922 0.5891 -0.002369 0.004171
fixed NA poly(age, 3, raw = TRUE)3 -0.00001601 0.00001891 -0.8466 5928 0.3972 -0.00005307 0.00002105
fixed NA male -0.1161 0.02398 -4.841 5845 0.000001323 -0.1631 -0.0691
fixed NA count_birth_order2/2 0.031 0.06149 0.5042 5331 0.6142 -0.08952 0.1515
fixed NA count_birth_order1/3 0.03858 0.05405 0.7138 5921 0.4754 -0.06735 0.1445
fixed NA count_birth_order2/3 0.04624 0.05861 0.789 5949 0.4302 -0.06863 0.1611
fixed NA count_birth_order3/3 -0.03029 0.06591 -0.4596 5959 0.6458 -0.1595 0.09889
fixed NA count_birth_order1/4 -0.09284 0.06392 -1.452 5945 0.1464 -0.2181 0.03244
fixed NA count_birth_order2/4 0.04085 0.06489 0.6295 5957 0.529 -0.08633 0.168
fixed NA count_birth_order3/4 -0.03359 0.07128 -0.4712 5954 0.6375 -0.1733 0.1061
fixed NA count_birth_order4/4 -0.05443 0.0736 -0.7396 5954 0.4596 -0.1987 0.08983
fixed NA count_birth_order1/5 0.01304 0.07582 0.172 5958 0.8635 -0.1356 0.1616
fixed NA count_birth_order2/5 0.04794 0.08135 0.5893 5948 0.5557 -0.1115 0.2074
fixed NA count_birth_order3/5 -0.003747 0.07911 -0.04736 5946 0.9622 -0.1588 0.1513
fixed NA count_birth_order4/5 -0.05214 0.08197 -0.6361 5935 0.5248 -0.2128 0.1085
fixed NA count_birth_order5/5 0.01449 0.0822 0.1763 5935 0.86 -0.1466 0.1756
fixed NA count_birth_order1/>5 -0.04045 0.07206 -0.5613 5959 0.5746 -0.1817 0.1008
fixed NA count_birth_order2/>5 -0.1055 0.07521 -1.403 5945 0.1607 -0.2529 0.04191
fixed NA count_birth_order3/>5 -0.01007 0.07364 -0.1367 5933 0.8913 -0.1544 0.1343
fixed NA count_birth_order4/>5 -0.08782 0.07098 -1.237 5932 0.2161 -0.2269 0.05131
fixed NA count_birth_order5/>5 -0.07425 0.07291 -1.018 5902 0.3085 -0.2171 0.06864
fixed NA count_birth_order>5/>5 -0.09624 0.05377 -1.79 5566 0.07355 -0.2016 0.009152
ran_pars mother_pidlink sd__(Intercept) 0.3582 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8629 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16110 16184 -8044 16088 NA NA NA
12 16112 16192 -8044 16088 0.0005688 1 0.981
16 16117 16225 -8043 16085 2.665 4 0.6153
26 16132 16306 -8040 16080 5.799 10 0.8318

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4531 0.4156 1.09 5754 0.2757 -0.3615 1.268
fixed NA poly(age, 3, raw = TRUE)1 -0.01023 0.04719 -0.2168 5757 0.8284 -0.1027 0.08226
fixed NA poly(age, 3, raw = TRUE)2 0.0004686 0.001685 0.2781 5761 0.7809 -0.002833 0.003771
fixed NA poly(age, 3, raw = TRUE)3 -0.00001034 0.00001909 -0.5417 5767 0.588 -0.00004776 0.00002708
fixed NA male -0.1113 0.02423 -4.593 5690 0.000004467 -0.1588 -0.0638
fixed NA sibling_count3 0.0278 0.03751 0.7411 4312 0.4587 -0.04572 0.1013
fixed NA sibling_count4 -0.03086 0.04071 -0.7581 3848 0.4484 -0.1107 0.04893
fixed NA sibling_count5 -0.05099 0.04803 -1.062 3372 0.2885 -0.1451 0.04315
fixed NA sibling_count>5 -0.1063 0.04162 -2.554 3184 0.01071 -0.1878 -0.0247
ran_pars mother_pidlink sd__(Intercept) 0.3613 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8587 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4481 0.4157 1.078 5753 0.2811 -0.3667 1.263
fixed NA birth_order 0.007437 0.008192 0.9078 5780 0.364 -0.008619 0.02349
fixed NA poly(age, 3, raw = TRUE)1 -0.01071 0.04719 -0.2268 5757 0.8206 -0.1032 0.08179
fixed NA poly(age, 3, raw = TRUE)2 0.0004727 0.001685 0.2806 5760 0.779 -0.002829 0.003775
fixed NA poly(age, 3, raw = TRUE)3 -0.00001009 0.0000191 -0.5283 5765 0.5973 -0.00004751 0.00002734
fixed NA male -0.1115 0.02424 -4.601 5689 0.000004298 -0.159 -0.064
fixed NA sibling_count3 0.02415 0.03773 0.6402 4316 0.5221 -0.04979 0.09809
fixed NA sibling_count4 -0.03934 0.04177 -0.9419 3873 0.3463 -0.1212 0.04253
fixed NA sibling_count5 -0.06446 0.05027 -1.282 3458 0.1999 -0.163 0.03407
fixed NA sibling_count>5 -0.1342 0.05175 -2.593 3809 0.009545 -0.2356 -0.03277
ran_pars mother_pidlink sd__(Intercept) 0.3613 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8587 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4518 0.4165 1.085 5758 0.278 -0.3644 1.268
fixed NA poly(age, 3, raw = TRUE)1 -0.01037 0.04723 -0.2196 5758 0.8262 -0.103 0.08221
fixed NA poly(age, 3, raw = TRUE)2 0.0004663 0.001686 0.2765 5760 0.7821 -0.002839 0.003772
fixed NA poly(age, 3, raw = TRUE)3 -0.00001016 0.00001911 -0.5316 5764 0.595 -0.00004763 0.0000273
fixed NA male -0.1112 0.02425 -4.585 5685 0.000004632 -0.1587 -0.06365
fixed NA sibling_count3 0.02459 0.03852 0.6384 4500 0.5232 -0.05091 0.1001
fixed NA sibling_count4 -0.03243 0.04344 -0.7466 4196 0.4553 -0.1176 0.0527
fixed NA sibling_count5 -0.04803 0.05255 -0.9139 3839 0.3608 -0.151 0.05497
fixed NA sibling_count>5 -0.119 0.05332 -2.231 4083 0.02571 -0.2235 -0.01447
fixed NA birth_order_nonlinear2 0.009103 0.03086 0.295 4820 0.768 -0.05137 0.06958
fixed NA birth_order_nonlinear3 0.01424 0.03819 0.3728 5019 0.7093 -0.06061 0.08909
fixed NA birth_order_nonlinear4 -0.008 0.04863 -0.1645 5165 0.8693 -0.1033 0.08732
fixed NA birth_order_nonlinear5 -0.01714 0.06154 -0.2786 5050 0.7806 -0.1378 0.1035
fixed NA birth_order_nonlinear>5 0.04256 0.06125 0.6948 5748 0.4872 -0.07749 0.1626
ran_pars mother_pidlink sd__(Intercept) 0.3603 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8594 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4984 0.4175 1.194 5751 0.2326 -0.3199 1.317
fixed NA poly(age, 3, raw = TRUE)1 -0.01432 0.04735 -0.3024 5749 0.7623 -0.1071 0.07848
fixed NA poly(age, 3, raw = TRUE)2 0.0006025 0.001691 0.3564 5752 0.7216 -0.002711 0.003916
fixed NA poly(age, 3, raw = TRUE)3 -0.00001163 0.00001917 -0.6066 5757 0.5441 -0.00004919 0.00002594
fixed NA male -0.1119 0.02427 -4.613 5674 0.000004065 -0.1595 -0.06437
fixed NA count_birth_order2/2 -0.02321 0.05452 -0.4258 5052 0.6703 -0.1301 0.08365
fixed NA count_birth_order1/3 0.0164 0.0492 0.3334 5750 0.7389 -0.08004 0.1128
fixed NA count_birth_order2/3 0.0359 0.05434 0.6607 5785 0.5089 -0.0706 0.1424
fixed NA count_birth_order3/3 0.005022 0.05963 0.08422 5789 0.9329 -0.1119 0.1219
fixed NA count_birth_order1/4 -0.05444 0.06119 -0.8898 5781 0.3736 -0.1744 0.06548
fixed NA count_birth_order2/4 0.01122 0.06281 0.1786 5789 0.8583 -0.1119 0.1343
fixed NA count_birth_order3/4 -0.05586 0.06573 -0.8499 5781 0.3954 -0.1847 0.07297
fixed NA count_birth_order4/4 -0.06476 0.06956 -0.9311 5775 0.3519 -0.2011 0.07157
fixed NA count_birth_order1/5 -0.1147 0.08246 -1.39 5789 0.1645 -0.2763 0.04697
fixed NA count_birth_order2/5 -0.0301 0.09102 -0.3307 5759 0.7409 -0.2085 0.1483
fixed NA count_birth_order3/5 -0.04437 0.08684 -0.511 5759 0.6094 -0.2146 0.1258
fixed NA count_birth_order4/5 -0.08581 0.0837 -1.025 5772 0.3053 -0.2499 0.07823
fixed NA count_birth_order5/5 -0.004708 0.08889 -0.05296 5759 0.9578 -0.1789 0.1695
fixed NA count_birth_order1/>5 -0.1188 0.08387 -1.416 5772 0.1568 -0.2831 0.04562
fixed NA count_birth_order2/>5 -0.2097 0.08314 -2.522 5761 0.01169 -0.3727 -0.04674
fixed NA count_birth_order3/>5 -0.02078 0.08233 -0.2523 5735 0.8008 -0.1821 0.1406
fixed NA count_birth_order4/>5 -0.1022 0.0805 -1.27 5709 0.2043 -0.26 0.05558
fixed NA count_birth_order5/>5 -0.1908 0.07401 -2.578 5733 0.009954 -0.3359 -0.04576
fixed NA count_birth_order>5/>5 -0.08773 0.0558 -1.572 5314 0.116 -0.1971 0.02165
ran_pars mother_pidlink sd__(Intercept) 0.3595 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8599 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15623 15696 -7801 15601 NA NA NA
12 15624 15704 -7800 15600 0.8254 1 0.3636
16 15632 15739 -7800 15600 0.2888 4 0.9905
26 15645 15818 -7796 15593 7.352 10 0.6918

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Adaptive Numbering

birthorder <- birthorder %>% mutate(outcome = adaptive_numbering)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3787 0.1518 2.495 13899 0.01262 0.08118 0.6763
fixed NA poly(age, 3, raw = TRUE)1 -0.0186 0.01457 -1.276 13882 0.2019 -0.04715 0.00996
fixed NA poly(age, 3, raw = TRUE)2 0.00058 0.0004296 1.35 13811 0.177 -0.000262 0.001422
fixed NA poly(age, 3, raw = TRUE)3 -0.00001002 0.000003964 -2.527 13702 0.01151 -0.00001779 -0.000002248
fixed NA male 0.09485 0.01571 6.038 13201 0.000000001602 0.06406 0.1256
fixed NA sibling_count3 0.032 0.03342 0.9577 9639 0.3382 -0.03349 0.0975
fixed NA sibling_count4 -0.01255 0.03463 -0.3623 8940 0.7171 -0.08042 0.05533
fixed NA sibling_count5 0.0188 0.03622 0.519 8209 0.6037 -0.05219 0.08979
fixed NA sibling_count>5 -0.1474 0.02824 -5.219 9034 0.0000001843 -0.2027 -0.09201
ran_pars mother_pidlink sd__(Intercept) 0.4629 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8391 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3788 0.1518 2.495 13899 0.0126 0.08125 0.6764
fixed NA birth_order 0.0008488 0.003398 0.2498 13686 0.8028 -0.005812 0.007509
fixed NA poly(age, 3, raw = TRUE)1 -0.01886 0.01461 -1.291 13876 0.1968 -0.04749 0.009776
fixed NA poly(age, 3, raw = TRUE)2 0.00059 0.0004315 1.367 13776 0.1715 -0.0002557 0.001436
fixed NA poly(age, 3, raw = TRUE)3 -0.00001011 0.000003983 -2.539 13641 0.01113 -0.00001792 -0.000002306
fixed NA male 0.09483 0.01571 6.036 13198 0.000000001619 0.06404 0.1256
fixed NA sibling_count3 0.03184 0.03343 0.9526 9643 0.3408 -0.03367 0.09735
fixed NA sibling_count4 -0.01309 0.0347 -0.3773 8996 0.7059 -0.08111 0.05492
fixed NA sibling_count5 0.0178 0.03644 0.4886 8323 0.6252 -0.05361 0.08922
fixed NA sibling_count>5 -0.1505 0.03095 -4.863 10228 0.000001174 -0.2112 -0.08985
ran_pars mother_pidlink sd__(Intercept) 0.4631 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.839 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3755 0.1522 2.467 13895 0.01363 0.07721 0.6739
fixed NA poly(age, 3, raw = TRUE)1 -0.01884 0.01461 -1.289 13875 0.1974 -0.04747 0.0098
fixed NA poly(age, 3, raw = TRUE)2 0.000594 0.0004315 1.376 13777 0.1687 -0.0002518 0.00144
fixed NA poly(age, 3, raw = TRUE)3 -0.00001017 0.000003984 -2.554 13635 0.01067 -0.00001798 -0.000002366
fixed NA male 0.0947 0.01571 6.028 13194 0.000000001706 0.06391 0.1255
fixed NA sibling_count3 0.03351 0.03383 0.9908 9953 0.3218 -0.03278 0.09981
fixed NA sibling_count4 -0.006042 0.03553 -0.1701 9610 0.865 -0.07568 0.06359
fixed NA sibling_count5 0.01888 0.03763 0.5017 9115 0.6159 -0.05487 0.09263
fixed NA sibling_count>5 -0.1519 0.03232 -4.701 11144 0.000002616 -0.2153 -0.0886
fixed NA birth_order_nonlinear2 0.006312 0.02259 0.2794 12336 0.7799 -0.03796 0.05059
fixed NA birth_order_nonlinear3 -0.004016 0.02658 -0.1511 11948 0.8799 -0.05611 0.04808
fixed NA birth_order_nonlinear4 -0.02674 0.03029 -0.8829 11934 0.3773 -0.08611 0.03263
fixed NA birth_order_nonlinear5 0.04054 0.03445 1.177 11911 0.2394 -0.02699 0.1081
fixed NA birth_order_nonlinear>5 0.0124 0.02911 0.4258 13684 0.6702 -0.04467 0.06946
ran_pars mother_pidlink sd__(Intercept) 0.4633 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.839 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3813 0.1528 2.495 13885 0.01261 0.08174 0.6808
fixed NA poly(age, 3, raw = TRUE)1 -0.01851 0.01461 -1.267 13865 0.2053 -0.04714 0.01013
fixed NA poly(age, 3, raw = TRUE)2 0.0005781 0.0004316 1.339 13762 0.1804 -0.0002678 0.001424
fixed NA poly(age, 3, raw = TRUE)3 -0.000009971 0.000003985 -2.502 13612 0.01237 -0.00001778 -0.00000216
fixed NA male 0.09384 0.01571 5.974 13182 0.000000002376 0.06305 0.1246
fixed NA count_birth_order2/2 -0.01282 0.04393 -0.2919 12643 0.7704 -0.09893 0.07329
fixed NA count_birth_order1/3 -0.01112 0.04301 -0.2585 13409 0.796 -0.09541 0.07317
fixed NA count_birth_order2/3 0.06464 0.04793 1.349 13659 0.1775 -0.0293 0.1586
fixed NA count_birth_order3/3 0.0586 0.05349 1.095 13826 0.2733 -0.04624 0.1634
fixed NA count_birth_order1/4 -0.04414 0.04894 -0.9019 13651 0.3671 -0.1401 0.05178
fixed NA count_birth_order2/4 -0.00802 0.05143 -0.156 13743 0.8761 -0.1088 0.09277
fixed NA count_birth_order3/4 0.01828 0.05567 0.3283 13860 0.7427 -0.09083 0.1274
fixed NA count_birth_order4/4 -0.02113 0.05884 -0.3592 13893 0.7195 -0.1364 0.09418
fixed NA count_birth_order1/5 -0.0386 0.05535 -0.6975 13811 0.4855 -0.1471 0.06987
fixed NA count_birth_order2/5 0.0696 0.05811 1.198 13868 0.231 -0.04429 0.1835
fixed NA count_birth_order3/5 -0.01428 0.05957 -0.2397 13892 0.8106 -0.131 0.1025
fixed NA count_birth_order4/5 0.002029 0.06299 0.03221 13904 0.9743 -0.1214 0.1255
fixed NA count_birth_order5/5 0.07302 0.06434 1.135 13901 0.2564 -0.05308 0.1991
fixed NA count_birth_order1/>5 -0.0773 0.04455 -1.735 13896 0.08278 -0.1646 0.01003
fixed NA count_birth_order2/>5 -0.1907 0.04587 -4.157 13904 0.00003243 -0.2806 -0.1008
fixed NA count_birth_order3/>5 -0.1895 0.04493 -4.217 13904 0.0000249 -0.2775 -0.1014
fixed NA count_birth_order4/>5 -0.1979 0.04407 -4.49 13902 0.000007175 -0.2843 -0.1115
fixed NA count_birth_order5/>5 -0.1246 0.04435 -2.81 13904 0.004968 -0.2116 -0.03768
fixed NA count_birth_order>5/>5 -0.1466 0.03553 -4.125 12295 0.00003725 -0.2162 -0.07693
ran_pars mother_pidlink sd__(Intercept) 0.4635 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8387 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 37830 37913 -18904 37808 NA NA NA
12 37832 37922 -18904 37808 0.0613 1 0.8045
16 37836 37957 -18902 37804 3.594 4 0.4637
26 37840 38036 -18894 37788 15.97 10 0.1004

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5739 0.3823 -1.501 5774 0.1333 -1.323 0.1753
fixed NA poly(age, 3, raw = TRUE)1 0.102 0.04338 2.351 5769 0.01874 0.01697 0.187
fixed NA poly(age, 3, raw = TRUE)2 -0.003674 0.001548 -2.373 5767 0.01768 -0.006709 -0.0006395
fixed NA poly(age, 3, raw = TRUE)3 0.00004194 0.00001754 2.391 5770 0.01681 0.000007568 0.00007632
fixed NA male 0.03722 0.02229 1.67 5660 0.09505 -0.006472 0.08091
fixed NA sibling_count3 -0.02318 0.03623 -0.6397 4238 0.5224 -0.09419 0.04783
fixed NA sibling_count4 -0.07966 0.03922 -2.031 3813 0.04233 -0.1565 -0.002783
fixed NA sibling_count5 -0.09175 0.04495 -2.041 3496 0.04132 -0.1799 -0.003645
fixed NA sibling_count>5 -0.2292 0.03956 -5.795 3364 0.000000007481 -0.3067 -0.1517
ran_pars mother_pidlink sd__(Intercept) 0.4128 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7721 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.581 0.3823 -1.52 5773 0.1286 -1.33 0.1683
fixed NA birth_order 0.009145 0.007438 1.229 5911 0.2189 -0.005433 0.02372
fixed NA poly(age, 3, raw = TRUE)1 0.1014 0.04338 2.338 5769 0.01942 0.0164 0.1864
fixed NA poly(age, 3, raw = TRUE)2 -0.003667 0.001548 -2.368 5766 0.0179 -0.006701 -0.0006323
fixed NA poly(age, 3, raw = TRUE)3 0.00004223 0.00001754 2.408 5767 0.01607 0.000007859 0.00007661
fixed NA male 0.03681 0.02229 1.651 5659 0.09872 -0.00688 0.0805
fixed NA sibling_count3 -0.02771 0.03642 -0.7608 4249 0.4468 -0.09909 0.04367
fixed NA sibling_count4 -0.09046 0.0402 -2.251 3839 0.02447 -0.1692 -0.01168
fixed NA sibling_count5 -0.1094 0.04718 -2.318 3609 0.02052 -0.2018 -0.01688
fixed NA sibling_count>5 -0.2643 0.04877 -5.419 3923 0.00000006361 -0.3599 -0.1687
ran_pars mother_pidlink sd__(Intercept) 0.4131 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7719 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5991 0.3831 -1.564 5786 0.1179 -1.35 0.1518
fixed NA poly(age, 3, raw = TRUE)1 0.104 0.04342 2.395 5775 0.01665 0.0189 0.1891
fixed NA poly(age, 3, raw = TRUE)2 -0.003757 0.00155 -2.425 5770 0.01536 -0.006795 -0.00072
fixed NA poly(age, 3, raw = TRUE)3 0.00004323 0.00001756 2.462 5769 0.01384 0.000008815 0.00007764
fixed NA male 0.03724 0.0223 1.67 5654 0.09492 -0.006459 0.08094
fixed NA sibling_count3 -0.03169 0.0371 -0.8543 4426 0.393 -0.1044 0.04102
fixed NA sibling_count4 -0.09277 0.04163 -2.228 4143 0.02591 -0.1744 -0.01117
fixed NA sibling_count5 -0.1259 0.04936 -2.55 4008 0.01081 -0.2226 -0.02913
fixed NA sibling_count>5 -0.2684 0.05009 -5.359 4152 0.00000008805 -0.3666 -0.1703
fixed NA birth_order_nonlinear2 0.02271 0.02845 0.7982 4741 0.4248 -0.03305 0.07847
fixed NA birth_order_nonlinear3 0.0366 0.03519 1.04 4938 0.2984 -0.03238 0.1056
fixed NA birth_order_nonlinear4 0.02322 0.04359 0.5326 5098 0.5943 -0.06222 0.1087
fixed NA birth_order_nonlinear5 0.1172 0.05437 2.156 4908 0.03115 0.01065 0.2238
fixed NA birth_order_nonlinear>5 0.04245 0.05526 0.7682 5770 0.4424 -0.06586 0.1508
ran_pars mother_pidlink sd__(Intercept) 0.413 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.772 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5894 0.384 -1.535 5781 0.1248 -1.342 0.1632
fixed NA poly(age, 3, raw = TRUE)1 0.1022 0.04351 2.348 5765 0.01891 0.01689 0.1875
fixed NA poly(age, 3, raw = TRUE)2 -0.003663 0.001553 -2.358 5762 0.0184 -0.006707 -0.0006186
fixed NA poly(age, 3, raw = TRUE)3 0.00004183 0.0000176 2.376 5762 0.01751 0.000007331 0.00007633
fixed NA male 0.03646 0.02231 1.634 5641 0.1023 -0.007272 0.08019
fixed NA count_birth_order2/2 0.02404 0.05166 0.4654 5112 0.6417 -0.07721 0.1253
fixed NA count_birth_order1/3 -0.05451 0.04671 -1.167 5813 0.2433 -0.1461 0.03704
fixed NA count_birth_order2/3 0.01584 0.05088 0.3112 5880 0.7557 -0.0839 0.1156
fixed NA count_birth_order3/3 0.01729 0.05675 0.3047 5898 0.7606 -0.09393 0.1285
fixed NA count_birth_order1/4 -0.1283 0.05698 -2.251 5872 0.0244 -0.2399 -0.0166
fixed NA count_birth_order2/4 -0.06935 0.05883 -1.179 5897 0.2386 -0.1847 0.04596
fixed NA count_birth_order3/4 -0.03725 0.06203 -0.6005 5888 0.5482 -0.1588 0.08433
fixed NA count_birth_order4/4 -0.03674 0.06447 -0.5699 5886 0.5688 -0.1631 0.08962
fixed NA count_birth_order1/5 -0.03692 0.07709 -0.4789 5894 0.632 -0.188 0.1142
fixed NA count_birth_order2/5 -0.1199 0.0823 -1.457 5843 0.1452 -0.2812 0.04141
fixed NA count_birth_order3/5 -0.154 0.07716 -1.996 5852 0.04598 -0.3052 -0.002782
fixed NA count_birth_order4/5 -0.1267 0.0744 -1.704 5876 0.08851 -0.2726 0.01907
fixed NA count_birth_order5/5 0.002534 0.07733 0.03277 5856 0.9739 -0.149 0.1541
fixed NA count_birth_order1/>5 -0.1809 0.07635 -2.37 5857 0.01783 -0.3306 -0.03129
fixed NA count_birth_order2/>5 -0.3047 0.07551 -4.035 5833 0.00005528 -0.4527 -0.1567
fixed NA count_birth_order3/>5 -0.2237 0.07552 -2.963 5789 0.003061 -0.3718 -0.07573
fixed NA count_birth_order4/>5 -0.2646 0.07115 -3.718 5793 0.0002025 -0.404 -0.1251
fixed NA count_birth_order5/>5 -0.1598 0.06737 -2.372 5806 0.01771 -0.2919 -0.02778
fixed NA count_birth_order>5/>5 -0.2265 0.05166 -4.384 5516 0.00001186 -0.3277 -0.1252
ran_pars mother_pidlink sd__(Intercept) 0.413 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7722 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15107 15181 -7543 15085 NA NA NA
12 15108 15188 -7542 15084 1.512 1 0.2188
16 15112 15219 -7540 15080 3.495 4 0.4787
26 15124 15298 -7536 15072 7.814 10 0.647

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.547 0.381 -1.436 5823 0.1511 -1.294 0.1998
fixed NA poly(age, 3, raw = TRUE)1 0.09819 0.04326 2.27 5816 0.02324 0.01341 0.183
fixed NA poly(age, 3, raw = TRUE)2 -0.003581 0.001544 -2.319 5813 0.02043 -0.006608 -0.0005544
fixed NA poly(age, 3, raw = TRUE)3 0.0000409 0.0000175 2.338 5816 0.01943 0.00000661 0.00007519
fixed NA male 0.03865 0.0222 1.741 5706 0.08169 -0.004853 0.08215
fixed NA sibling_count3 -0.001308 0.03913 -0.03344 4392 0.9733 -0.078 0.07538
fixed NA sibling_count4 -0.05356 0.04142 -1.293 4053 0.1961 -0.1347 0.02763
fixed NA sibling_count5 -0.04134 0.04448 -0.9294 3723 0.3527 -0.1285 0.04584
fixed NA sibling_count>5 -0.1437 0.03893 -3.692 3869 0.0002256 -0.22 -0.06743
ran_pars mother_pidlink sd__(Intercept) 0.4147 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7712 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.548 0.3811 -1.438 5822 0.1505 -1.295 0.1989
fixed NA birth_order 0.0009386 0.006519 0.144 5926 0.8855 -0.01184 0.01372
fixed NA poly(age, 3, raw = TRUE)1 0.09817 0.04326 2.269 5815 0.02329 0.01338 0.183
fixed NA poly(age, 3, raw = TRUE)2 -0.003582 0.001544 -2.319 5812 0.02042 -0.006608 -0.0005547
fixed NA poly(age, 3, raw = TRUE)3 0.00004095 0.0000175 2.34 5814 0.01933 0.000006647 0.00007524
fixed NA male 0.03861 0.0222 1.739 5705 0.082 -0.004894 0.08212
fixed NA sibling_count3 -0.001773 0.03926 -0.04515 4393 0.964 -0.07873 0.07518
fixed NA sibling_count4 -0.05462 0.04208 -1.298 4053 0.1943 -0.1371 0.02785
fixed NA sibling_count5 -0.04301 0.04597 -0.9356 3759 0.3495 -0.1331 0.04709
fixed NA sibling_count>5 -0.1472 0.04585 -3.211 4213 0.001332 -0.2371 -0.05736
ran_pars mother_pidlink sd__(Intercept) 0.4149 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7712 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5634 0.3817 -1.476 5834 0.1399 -1.311 0.1846
fixed NA poly(age, 3, raw = TRUE)1 0.09955 0.04328 2.3 5821 0.02147 0.01473 0.1844
fixed NA poly(age, 3, raw = TRUE)2 -0.003632 0.001545 -2.35 5817 0.01878 -0.00666 -0.0006033
fixed NA poly(age, 3, raw = TRUE)3 0.00004154 0.00001751 2.373 5816 0.0177 0.000007224 0.00007586
fixed NA male 0.03953 0.0222 1.781 5701 0.07498 -0.003975 0.08303
fixed NA sibling_count3 0.0002314 0.03989 0.005801 4546 0.9954 -0.07796 0.07842
fixed NA sibling_count4 -0.04784 0.04341 -1.102 4325 0.2705 -0.1329 0.03725
fixed NA sibling_count5 -0.05674 0.04795 -1.183 4125 0.2367 -0.1507 0.03724
fixed NA sibling_count>5 -0.1505 0.04712 -3.194 4452 0.001413 -0.2429 -0.05815
fixed NA birth_order_nonlinear2 0.01206 0.02899 0.416 4884 0.6774 -0.04476 0.06888
fixed NA birth_order_nonlinear3 -0.007123 0.03509 -0.203 5065 0.8391 -0.0759 0.06165
fixed NA birth_order_nonlinear4 -0.02017 0.04232 -0.4766 5235 0.6337 -0.1031 0.06278
fixed NA birth_order_nonlinear5 0.119 0.05185 2.294 5125 0.0218 0.01734 0.2206
fixed NA birth_order_nonlinear>5 -0.007059 0.04951 -0.1426 5918 0.8866 -0.1041 0.08997
ran_pars mother_pidlink sd__(Intercept) 0.4146 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.771 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5329 0.3822 -1.394 5831 0.1633 -1.282 0.2162
fixed NA poly(age, 3, raw = TRUE)1 0.09492 0.04332 2.191 5813 0.02846 0.01003 0.1798
fixed NA poly(age, 3, raw = TRUE)2 -0.00344 0.001547 -2.224 5809 0.02617 -0.006472 -0.0004087
fixed NA poly(age, 3, raw = TRUE)3 0.00003911 0.00001753 2.231 5810 0.02573 0.000004748 0.00007347
fixed NA male 0.03859 0.0222 1.739 5690 0.08215 -0.004913 0.0821
fixed NA count_birth_order2/2 0.02549 0.05653 0.4508 5251 0.6521 -0.08532 0.1363
fixed NA count_birth_order1/3 -0.01494 0.05051 -0.2957 5865 0.7675 -0.1139 0.08406
fixed NA count_birth_order2/3 0.0181 0.05465 0.3312 5927 0.7405 -0.08901 0.1252
fixed NA count_birth_order3/3 0.03519 0.06135 0.5737 5949 0.5662 -0.08505 0.1554
fixed NA count_birth_order1/4 -0.1124 0.05962 -1.886 5920 0.05939 -0.2293 0.004432
fixed NA count_birth_order2/4 0.02033 0.06071 0.3348 5945 0.7378 -0.09866 0.1393
fixed NA count_birth_order3/4 -0.01424 0.06636 -0.2146 5938 0.8301 -0.1443 0.1158
fixed NA count_birth_order4/4 -0.06868 0.06842 -1.004 5940 0.3155 -0.2028 0.06542
fixed NA count_birth_order1/5 0.01101 0.07059 0.1559 5948 0.8761 -0.1274 0.1494
fixed NA count_birth_order2/5 -0.05006 0.07557 -0.6624 5923 0.5077 -0.1982 0.09805
fixed NA count_birth_order3/5 -0.1674 0.07348 -2.278 5922 0.02277 -0.3114 -0.02335
fixed NA count_birth_order4/5 -0.07244 0.07609 -0.952 5904 0.3411 -0.2216 0.07669
fixed NA count_birth_order5/5 0.1097 0.0763 1.438 5906 0.1504 -0.03981 0.2593
fixed NA count_birth_order1/>5 -0.0476 0.06705 -0.7099 5948 0.4778 -0.179 0.08382
fixed NA count_birth_order2/>5 -0.2193 0.06985 -3.139 5909 0.001703 -0.3561 -0.08236
fixed NA count_birth_order3/>5 -0.1526 0.06844 -2.229 5891 0.02584 -0.2867 -0.01843
fixed NA count_birth_order4/>5 -0.1628 0.06588 -2.471 5896 0.01352 -0.2919 -0.03363
fixed NA count_birth_order5/>5 -0.06021 0.06758 -0.891 5842 0.373 -0.1927 0.07224
fixed NA count_birth_order>5/>5 -0.1548 0.05053 -3.063 5608 0.002199 -0.2538 -0.05575
ran_pars mother_pidlink sd__(Intercept) 0.4146 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7706 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15237 15311 -7608 15215 NA NA NA
12 15239 15319 -7608 15215 0.02042 1 0.8864
16 15239 15346 -7604 15207 7.892 4 0.09562
26 15244 15418 -7596 15192 15.53 10 0.1138

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.6109 0.3868 -1.579 5647 0.1143 -1.369 0.1473
fixed NA poly(age, 3, raw = TRUE)1 0.1055 0.04391 2.404 5640 0.01627 0.01948 0.1916
fixed NA poly(age, 3, raw = TRUE)2 -0.003789 0.001568 -2.417 5636 0.0157 -0.006861 -0.0007159
fixed NA poly(age, 3, raw = TRUE)3 0.00004303 0.00001777 2.422 5637 0.01548 0.000008203 0.00007785
fixed NA male 0.03418 0.02252 1.518 5529 0.1291 -0.009957 0.07831
fixed NA sibling_count3 -0.01054 0.03585 -0.294 4150 0.7688 -0.08081 0.05973
fixed NA sibling_count4 -0.08272 0.03907 -2.117 3755 0.03428 -0.1593 -0.006154
fixed NA sibling_count5 -0.07539 0.04627 -1.629 3360 0.1033 -0.1661 0.01529
fixed NA sibling_count>5 -0.2279 0.04017 -5.672 3233 0.00000001533 -0.3066 -0.1491
ran_pars mother_pidlink sd__(Intercept) 0.4197 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7695 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.6191 0.3868 -1.601 5646 0.1095 -1.377 0.1389
fixed NA birth_order 0.0126 0.007659 1.645 5784 0.09994 -0.002409 0.02762
fixed NA poly(age, 3, raw = TRUE)1 0.1046 0.04391 2.383 5640 0.01723 0.01855 0.1907
fixed NA poly(age, 3, raw = TRUE)2 -0.003775 0.001567 -2.408 5635 0.01606 -0.006847 -0.0007029
fixed NA poly(age, 3, raw = TRUE)3 0.0000434 0.00001777 2.443 5634 0.0146 0.00000858 0.00007822
fixed NA male 0.03386 0.02252 1.504 5528 0.1327 -0.01027 0.07799
fixed NA sibling_count3 -0.01685 0.03605 -0.4673 4161 0.6403 -0.08751 0.05382
fixed NA sibling_count4 -0.0974 0.04007 -2.431 3795 0.01511 -0.1759 -0.01887
fixed NA sibling_count5 -0.09864 0.04838 -2.039 3465 0.04152 -0.1935 -0.003825
fixed NA sibling_count>5 -0.2758 0.04961 -5.559 3874 0.00000002902 -0.373 -0.1785
ran_pars mother_pidlink sd__(Intercept) 0.42 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7693 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.638 0.3876 -1.646 5661 0.09976 -1.398 0.1216
fixed NA poly(age, 3, raw = TRUE)1 0.1074 0.04395 2.444 5648 0.01454 0.02129 0.1936
fixed NA poly(age, 3, raw = TRUE)2 -0.003874 0.001569 -2.469 5641 0.01356 -0.006949 -0.0007993
fixed NA poly(age, 3, raw = TRUE)3 0.00004448 0.00001778 2.501 5638 0.0124 0.000009626 0.00007934
fixed NA male 0.03404 0.02252 1.511 5524 0.1308 -0.0101 0.07818
fixed NA sibling_count3 -0.0171 0.03674 -0.4653 4339 0.6417 -0.08911 0.05492
fixed NA sibling_count4 -0.09868 0.04153 -2.376 4097 0.01754 -0.1801 -0.01729
fixed NA sibling_count5 -0.1131 0.05037 -2.245 3816 0.02482 -0.2118 -0.01436
fixed NA sibling_count>5 -0.2769 0.05098 -5.432 4118 0.00000005882 -0.3768 -0.177
fixed NA birth_order_nonlinear2 0.03343 0.02836 1.179 4610 0.2385 -0.02215 0.08901
fixed NA birth_order_nonlinear3 0.02907 0.03517 0.8265 4793 0.4085 -0.03986 0.09799
fixed NA birth_order_nonlinear4 0.04795 0.04482 1.07 4936 0.2847 -0.03988 0.1358
fixed NA birth_order_nonlinear5 0.1317 0.05668 2.324 4775 0.02016 0.02065 0.2428
fixed NA birth_order_nonlinear>5 0.06088 0.05697 1.069 5592 0.2853 -0.05078 0.1725
ran_pars mother_pidlink sd__(Intercept) 0.4191 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7697 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.6225 0.3884 -1.602 5657 0.1091 -1.384 0.1389
fixed NA poly(age, 3, raw = TRUE)1 0.1047 0.04404 2.378 5640 0.01743 0.01842 0.1911
fixed NA poly(age, 3, raw = TRUE)2 -0.003746 0.001573 -2.382 5635 0.01726 -0.006828 -0.0006634
fixed NA poly(age, 3, raw = TRUE)3 0.00004268 0.00001783 2.394 5634 0.01671 0.000007732 0.00007762
fixed NA male 0.03277 0.02253 1.454 5510 0.146 -0.0114 0.07693
fixed NA count_birth_order2/2 0.0373 0.05023 0.7426 4934 0.4578 -0.06115 0.1358
fixed NA count_birth_order1/3 -0.0397 0.04617 -0.86 5695 0.3898 -0.1302 0.05078
fixed NA count_birth_order2/3 0.04364 0.05085 0.8583 5769 0.3908 -0.05602 0.1433
fixed NA count_birth_order3/3 0.02499 0.05573 0.4484 5779 0.6539 -0.08424 0.1342
fixed NA count_birth_order1/4 -0.1454 0.05724 -2.54 5764 0.01112 -0.2576 -0.03319
fixed NA count_birth_order2/4 -0.06066 0.05873 -1.033 5779 0.3017 -0.1758 0.05444
fixed NA count_birth_order3/4 -0.04567 0.06138 -0.744 5765 0.4569 -0.166 0.07463
fixed NA count_birth_order4/4 -0.009882 0.06483 -0.1524 5754 0.8788 -0.1369 0.1172
fixed NA count_birth_order1/5 -0.03364 0.07699 -0.4369 5778 0.6622 -0.1845 0.1173
fixed NA count_birth_order2/5 -0.1226 0.08473 -1.447 5710 0.1479 -0.2887 0.04345
fixed NA count_birth_order3/5 -0.1298 0.08084 -1.606 5717 0.1083 -0.2883 0.02861
fixed NA count_birth_order4/5 -0.08387 0.07798 -1.075 5747 0.2822 -0.2367 0.06897
fixed NA count_birth_order5/5 0.0319 0.08276 0.3854 5722 0.6999 -0.1303 0.1941
fixed NA count_birth_order1/>5 -0.1417 0.07812 -1.814 5726 0.06966 -0.2948 0.01137
fixed NA count_birth_order2/>5 -0.3013 0.07739 -3.893 5700 0.0001002 -0.4529 -0.1496
fixed NA count_birth_order3/>5 -0.2695 0.07655 -3.521 5658 0.0004334 -0.4196 -0.1195
fixed NA count_birth_order4/>5 -0.2658 0.07478 -3.554 5615 0.0003827 -0.4123 -0.1192
fixed NA count_birth_order5/>5 -0.1536 0.06895 -2.227 5669 0.02596 -0.2887 -0.01844
fixed NA count_birth_order>5/>5 -0.2161 0.05268 -4.102 5393 0.0000416 -0.3193 -0.1128
ran_pars mother_pidlink sd__(Intercept) 0.4191 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.7697 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 14808 14882 -7393 14786 NA NA NA
12 14808 14888 -7392 14784 2.71 1 0.09974
16 14813 14919 -7390 14781 3.147 4 0.5336
26 14822 14995 -7385 14770 10.48 10 0.3993

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Personality

Extraversion

birthorder <- birthorder %>% mutate(outcome = big5_ext)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5858 0.1594 3.676 13656 0.0002379 0.2735 0.8982
fixed NA poly(age, 3, raw = TRUE)1 -0.0431 0.01526 -2.824 13524 0.004743 -0.07301 -0.01319
fixed NA poly(age, 3, raw = TRUE)2 0.001286 0.0004482 2.868 13337 0.004134 0.0004071 0.002164
fixed NA poly(age, 3, raw = TRUE)3 -0.00001265 0.000004122 -3.068 13167 0.002158 -0.00002073 -0.000004568
fixed NA male -0.2258 0.01689 -13.37 13875 1.703e-40 -0.2589 -0.1927
fixed NA sibling_count3 0.009322 0.03332 0.2798 10744 0.7796 -0.05598 0.07462
fixed NA sibling_count4 -0.02026 0.03419 -0.5925 9730 0.5535 -0.08728 0.04676
fixed NA sibling_count5 -0.02693 0.03538 -0.7611 8569 0.4466 -0.09627 0.04241
fixed NA sibling_count>5 -0.01081 0.02791 -0.3874 9811 0.6985 -0.06552 0.0439
ran_pars mother_pidlink sd__(Intercept) 0.2287 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9711 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5841 0.1594 3.665 13657 0.0002481 0.2718 0.8965
fixed NA birth_order -0.003173 0.003493 -0.9085 10861 0.3636 -0.01002 0.003673
fixed NA poly(age, 3, raw = TRUE)1 -0.04216 0.01529 -2.757 13506 0.005845 -0.07214 -0.01219
fixed NA poly(age, 3, raw = TRUE)2 0.001253 0.0004497 2.786 13275 0.00534 0.0003715 0.002134
fixed NA poly(age, 3, raw = TRUE)3 -0.00001235 0.000004135 -2.987 13084 0.002821 -0.00002045 -0.000004247
fixed NA male -0.2257 0.01689 -13.36 13875 1.846e-40 -0.2588 -0.1926
fixed NA sibling_count3 0.01013 0.03333 0.304 10759 0.7611 -0.05519 0.07545
fixed NA sibling_count4 -0.01798 0.03428 -0.5243 9787 0.6001 -0.08517 0.04922
fixed NA sibling_count5 -0.02301 0.03564 -0.6457 8664 0.5185 -0.09286 0.04684
fixed NA sibling_count>5 0.001366 0.03097 0.0441 10715 0.9648 -0.05933 0.06206
ran_pars mother_pidlink sd__(Intercept) 0.2281 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9712 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5626 0.1598 3.521 13662 0.000432 0.2494 0.8758
fixed NA poly(age, 3, raw = TRUE)1 -0.04263 0.0153 -2.787 13519 0.005334 -0.07262 -0.01265
fixed NA poly(age, 3, raw = TRUE)2 0.001264 0.0004498 2.809 13289 0.004972 0.000382 0.002145
fixed NA poly(age, 3, raw = TRUE)3 -0.00001237 0.000004136 -2.991 13086 0.00279 -0.00002048 -0.000004262
fixed NA male -0.2257 0.01689 -13.36 13869 1.765e-40 -0.2588 -0.1926
fixed NA sibling_count3 0.01351 0.03385 0.3991 11096 0.6898 -0.05284 0.07985
fixed NA sibling_count4 -0.01763 0.03537 -0.4984 10527 0.6182 -0.08695 0.05169
fixed NA sibling_count5 -0.02496 0.03719 -0.6712 9678 0.5021 -0.09785 0.04793
fixed NA sibling_count>5 -0.005669 0.03271 -0.1733 11890 0.8624 -0.06978 0.05845
fixed NA birth_order_nonlinear2 0.05536 0.02472 2.239 12810 0.02515 0.006905 0.1038
fixed NA birth_order_nonlinear3 -0.003555 0.02919 -0.1218 12714 0.903 -0.06076 0.05365
fixed NA birth_order_nonlinear4 0.02086 0.03323 0.6278 12831 0.5301 -0.04427 0.086
fixed NA birth_order_nonlinear5 0.02606 0.03779 0.6897 12919 0.4904 -0.048 0.1001
fixed NA birth_order_nonlinear>5 0.01193 0.031 0.3846 13899 0.7005 -0.04884 0.07269
ran_pars mother_pidlink sd__(Intercept) 0.229 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9709 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5658 0.1605 3.525 13666 0.0004256 0.2511 0.8804
fixed NA poly(age, 3, raw = TRUE)1 -0.04235 0.0153 -2.767 13511 0.005661 -0.07234 -0.01235
fixed NA poly(age, 3, raw = TRUE)2 0.001259 0.0004499 2.799 13275 0.00514 0.0003773 0.002141
fixed NA poly(age, 3, raw = TRUE)3 -0.00001236 0.000004137 -2.987 13066 0.002821 -0.00002047 -0.00000425
fixed NA male -0.2255 0.0169 -13.35 13859 2.147e-40 -0.2587 -0.1924
fixed NA count_birth_order2/2 0.03555 0.04808 0.7393 12561 0.4597 -0.05869 0.1298
fixed NA count_birth_order1/3 0.006548 0.04502 0.1454 13872 0.8844 -0.08169 0.09478
fixed NA count_birth_order2/3 0.0579 0.05035 1.15 13888 0.2502 -0.04078 0.1566
fixed NA count_birth_order3/3 0.006575 0.05641 0.1166 13902 0.9072 -0.104 0.1171
fixed NA count_birth_order1/4 -0.03226 0.05142 -0.6274 13891 0.5304 -0.133 0.06852
fixed NA count_birth_order2/4 0.09717 0.05408 1.797 13895 0.07239 -0.008825 0.2032
fixed NA count_birth_order3/4 -0.06283 0.05877 -1.069 13902 0.285 -0.178 0.05235
fixed NA count_birth_order4/4 -0.0513 0.06223 -0.8244 13907 0.4097 -0.1733 0.07066
fixed NA count_birth_order1/5 -0.04349 0.05836 -0.7453 13903 0.4561 -0.1579 0.07088
fixed NA count_birth_order2/5 -0.01869 0.06139 -0.3045 13907 0.7608 -0.139 0.1016
fixed NA count_birth_order3/5 -0.0007656 0.06302 -0.01215 13908 0.9903 -0.1243 0.1227
fixed NA count_birth_order4/5 0.04999 0.06676 0.7488 13910 0.454 -0.08086 0.1808
fixed NA count_birth_order5/5 -0.04369 0.06825 -0.6402 13910 0.5221 -0.1775 0.09008
fixed NA count_birth_order1/>5 -0.01372 0.04714 -0.2911 13908 0.771 -0.1061 0.07867
fixed NA count_birth_order2/>5 0.03022 0.04863 0.6215 13910 0.5343 -0.06509 0.1255
fixed NA count_birth_order3/>5 -0.01704 0.04765 -0.3577 13910 0.7205 -0.1104 0.07634
fixed NA count_birth_order4/>5 0.005439 0.04669 0.1165 13910 0.9073 -0.08607 0.09695
fixed NA count_birth_order5/>5 0.02545 0.04704 0.5409 13910 0.5886 -0.06675 0.1176
fixed NA count_birth_order>5/>5 -0.001348 0.03641 -0.03702 12691 0.9705 -0.07272 0.07002
ran_pars mother_pidlink sd__(Intercept) 0.2285 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9712 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 39460 39543 -19719 39438 NA NA NA
12 39461 39552 -19719 39437 0.8272 1 0.3631
16 39464 39585 -19716 39432 5.522 4 0.2378
26 39477 39673 -19713 39425 6.545 10 0.7676

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.152 0.4495 2.564 5915 0.01038 0.2714 2.033
fixed NA poly(age, 3, raw = TRUE)1 -0.1016 0.05098 -1.992 5912 0.04638 -0.2015 -0.001649
fixed NA poly(age, 3, raw = TRUE)2 0.003476 0.001819 1.912 5905 0.05597 -0.00008788 0.007041
fixed NA poly(age, 3, raw = TRUE)3 -0.00003723 0.00002058 -1.809 5894 0.07052 -0.00007757 0.00000311
fixed NA male -0.2631 0.02631 -10 5907 2.341e-23 -0.3147 -0.2115
fixed NA sibling_count3 -0.03372 0.04026 -0.8374 4587 0.4024 -0.1126 0.0452
fixed NA sibling_count4 -0.08771 0.04309 -2.036 3960 0.04186 -0.1722 -0.003257
fixed NA sibling_count5 -0.08529 0.04889 -1.744 3420 0.08116 -0.1811 0.01054
fixed NA sibling_count>5 -0.09583 0.04277 -2.241 3060 0.02513 -0.1797 -0.012
ran_pars mother_pidlink sd__(Intercept) 0.1894 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9934 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.141 0.4495 2.539 5914 0.01115 0.2601 2.022
fixed NA birth_order 0.01356 0.008594 1.578 5399 0.1147 -0.003286 0.0304
fixed NA poly(age, 3, raw = TRUE)1 -0.1021 0.05098 -2.003 5911 0.04524 -0.202 -0.002184
fixed NA poly(age, 3, raw = TRUE)2 0.003471 0.001818 1.909 5905 0.05636 -0.00009333 0.007034
fixed NA poly(age, 3, raw = TRUE)3 -0.00003665 0.00002058 -1.78 5894 0.07507 -0.00007699 0.000003697
fixed NA male -0.2636 0.02631 -10.02 5906 1.892e-23 -0.3152 -0.2121
fixed NA sibling_count3 -0.04022 0.04048 -0.9935 4582 0.3205 -0.1196 0.03912
fixed NA sibling_count4 -0.103 0.04417 -2.331 3945 0.01981 -0.1895 -0.01639
fixed NA sibling_count5 -0.1104 0.05143 -2.146 3462 0.03195 -0.2112 -0.009566
fixed NA sibling_count>5 -0.1462 0.05344 -2.736 3559 0.006244 -0.251 -0.04149
ran_pars mother_pidlink sd__(Intercept) 0.1924 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9927 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.11 0.4497 2.467 5909 0.01365 0.228 1.991
fixed NA poly(age, 3, raw = TRUE)1 -0.09789 0.05096 -1.921 5906 0.05481 -0.1978 0.001998
fixed NA poly(age, 3, raw = TRUE)2 0.003318 0.001818 1.825 5899 0.068 -0.0002447 0.006882
fixed NA poly(age, 3, raw = TRUE)3 -0.00003493 0.00002058 -1.697 5887 0.08976 -0.00007527 0.000005413
fixed NA male -0.2635 0.02629 -10.02 5902 1.924e-23 -0.315 -0.2119
fixed NA sibling_count3 -0.04151 0.04136 -1.004 4779 0.3156 -0.1226 0.03955
fixed NA sibling_count4 -0.1168 0.04604 -2.538 4319 0.01119 -0.2071 -0.0266
fixed NA sibling_count5 -0.1589 0.0543 -2.927 3964 0.003447 -0.2653 -0.05248
fixed NA sibling_count>5 -0.1572 0.05516 -2.85 3888 0.004398 -0.2653 -0.04908
fixed NA birth_order_nonlinear2 0.03992 0.03448 1.158 5118 0.247 -0.02766 0.1075
fixed NA birth_order_nonlinear3 0.03437 0.04242 0.8102 5378 0.4178 -0.04877 0.1175
fixed NA birth_order_nonlinear4 0.1099 0.05233 2.101 5536 0.03571 0.007368 0.2125
fixed NA birth_order_nonlinear5 0.2364 0.06542 3.614 5478 0.0003043 0.1082 0.3647
fixed NA birth_order_nonlinear>5 0.03262 0.06472 0.504 5852 0.6143 -0.09422 0.1595
ran_pars mother_pidlink sd__(Intercept) 0.1872 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9929 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.085 0.4508 2.407 5899 0.01613 0.2013 1.968
fixed NA poly(age, 3, raw = TRUE)1 -0.09453 0.05108 -1.851 5896 0.06429 -0.1946 0.005591
fixed NA poly(age, 3, raw = TRUE)2 0.003205 0.001822 1.758 5889 0.07873 -0.0003673 0.006776
fixed NA poly(age, 3, raw = TRUE)3 -0.00003372 0.00002064 -1.634 5878 0.1024 -0.00007416 0.000006732
fixed NA male -0.2623 0.02632 -9.964 5892 3.326e-23 -0.3138 -0.2107
fixed NA count_birth_order2/2 0.02096 0.06225 0.3367 5228 0.7364 -0.1011 0.143
fixed NA count_birth_order1/3 -0.08328 0.05417 -1.537 5897 0.1243 -0.1895 0.02289
fixed NA count_birth_order2/3 0.03793 0.05923 0.6403 5899 0.522 -0.07817 0.154
fixed NA count_birth_order3/3 -0.01001 0.06626 -0.151 5900 0.88 -0.1399 0.1199
fixed NA count_birth_order1/4 -0.06131 0.06625 -0.9255 5896 0.3548 -0.1912 0.06854
fixed NA count_birth_order2/4 -0.1186 0.06863 -1.728 5900 0.08396 -0.2531 0.01589
fixed NA count_birth_order3/4 -0.1046 0.07259 -1.442 5899 0.1495 -0.2469 0.03763
fixed NA count_birth_order4/4 -0.04082 0.07548 -0.5408 5898 0.5886 -0.1887 0.1071
fixed NA count_birth_order1/5 -0.1233 0.09008 -1.368 5900 0.1712 -0.2998 0.05329
fixed NA count_birth_order2/5 -0.163 0.09652 -1.689 5899 0.09127 -0.3522 0.02615
fixed NA count_birth_order3/5 -0.1296 0.0905 -1.432 5898 0.1521 -0.307 0.04775
fixed NA count_birth_order4/5 -0.05215 0.08716 -0.5983 5898 0.5497 -0.223 0.1187
fixed NA count_birth_order5/5 0.05478 0.09073 0.6037 5895 0.5461 -0.1231 0.2326
fixed NA count_birth_order1/>5 -0.2236 0.08934 -2.503 5891 0.01235 -0.3987 -0.04849
fixed NA count_birth_order2/>5 -0.1293 0.0885 -1.461 5896 0.144 -0.3028 0.04414
fixed NA count_birth_order3/>5 -0.1131 0.08873 -1.275 5900 0.2025 -0.287 0.06082
fixed NA count_birth_order4/>5 -0.0233 0.08363 -0.2786 5899 0.7806 -0.1872 0.1406
fixed NA count_birth_order5/>5 0.08399 0.07903 1.063 5898 0.2879 -0.07091 0.2389
fixed NA count_birth_order>5/>5 -0.1312 0.05874 -2.234 5149 0.02554 -0.2463 -0.01608
ran_pars mother_pidlink sd__(Intercept) 0.1883 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9931 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16954 17028 -8466 16932 NA NA NA
12 16954 17034 -8465 16930 2.483 1 0.1151
16 16948 17055 -8458 16916 13.26 4 0.01007
26 16963 17137 -8456 16911 5.148 10 0.8811

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.163 0.4489 2.591 5966 0.009594 0.2832 2.043
fixed NA poly(age, 3, raw = TRUE)1 -0.1022 0.05094 -2.007 5963 0.04481 -0.2021 -0.002389
fixed NA poly(age, 3, raw = TRUE)2 0.003524 0.001817 1.939 5956 0.05255 -0.00003806 0.007086
fixed NA poly(age, 3, raw = TRUE)3 -0.00003799 0.00002057 -1.847 5944 0.06485 -0.00007832 0.000002332
fixed NA male -0.2654 0.02625 -10.11 5957 7.751e-24 -0.3169 -0.214
fixed NA sibling_count3 -0.03632 0.04368 -0.8315 4742 0.4057 -0.1219 0.04929
fixed NA sibling_count4 -0.07942 0.04582 -1.733 4276 0.08311 -0.1692 0.01039
fixed NA sibling_count5 -0.1033 0.04875 -2.119 3745 0.03416 -0.1988 -0.007751
fixed NA sibling_count>5 -0.1059 0.04277 -2.477 3778 0.01329 -0.1898 -0.02212
ran_pars mother_pidlink sd__(Intercept) 0.1912 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9951 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.15 0.4489 2.561 5965 0.01046 0.2698 2.029
fixed NA birth_order 0.01209 0.007482 1.616 5017 0.1061 -0.002573 0.02676
fixed NA poly(age, 3, raw = TRUE)1 -0.1023 0.05093 -2.009 5962 0.04463 -0.2021 -0.002473
fixed NA poly(age, 3, raw = TRUE)2 0.003505 0.001817 1.929 5956 0.05384 -0.00005715 0.007066
fixed NA poly(age, 3, raw = TRUE)3 -0.00003732 0.00002058 -1.813 5945 0.06981 -0.00007765 0.000003014
fixed NA male -0.2658 0.02625 -10.13 5956 6.65e-24 -0.3173 -0.2144
fixed NA sibling_count3 -0.04207 0.04384 -0.9598 4733 0.3372 -0.128 0.04385
fixed NA sibling_count4 -0.0925 0.04655 -1.987 4245 0.04695 -0.1837 -0.001275
fixed NA sibling_count5 -0.1239 0.05041 -2.458 3726 0.01402 -0.2227 -0.0251
fixed NA sibling_count>5 -0.1499 0.05073 -2.954 4023 0.003152 -0.2493 -0.05044
ran_pars mother_pidlink sd__(Intercept) 0.1956 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9941 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.141 0.4493 2.539 5960 0.01115 0.26 2.021
fixed NA poly(age, 3, raw = TRUE)1 -0.1002 0.05094 -1.968 5957 0.04915 -0.2001 -0.0003941
fixed NA poly(age, 3, raw = TRUE)2 0.003429 0.001818 1.887 5950 0.05926 -0.0001333 0.006992
fixed NA poly(age, 3, raw = TRUE)3 -0.00003645 0.00002059 -1.771 5938 0.07669 -0.00007679 0.0000039
fixed NA male -0.2649 0.02625 -10.09 5952 9.261e-24 -0.3164 -0.2135
fixed NA sibling_count3 -0.04594 0.0447 -1.028 4891 0.3041 -0.1335 0.04167
fixed NA sibling_count4 -0.09413 0.04833 -1.948 4558 0.05151 -0.1889 0.0005931
fixed NA sibling_count5 -0.1497 0.05306 -2.821 4177 0.004811 -0.2537 -0.04569
fixed NA sibling_count>5 -0.1589 0.05247 -3.027 4390 0.002481 -0.2617 -0.05601
fixed NA birth_order_nonlinear2 0.02093 0.03515 0.5955 5239 0.5515 -0.04796 0.08982
fixed NA birth_order_nonlinear3 0.04145 0.04233 0.9792 5491 0.3275 -0.04151 0.1244
fixed NA birth_order_nonlinear4 0.02811 0.05083 0.5529 5639 0.5803 -0.07152 0.1277
fixed NA birth_order_nonlinear5 0.1845 0.06237 2.959 5642 0.003104 0.06228 0.3068
fixed NA birth_order_nonlinear>5 0.06251 0.0578 1.081 5821 0.2796 -0.05078 0.1758
ran_pars mother_pidlink sd__(Intercept) 0.1939 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9942 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.137 0.4502 2.525 5950 0.01159 0.2545 2.019
fixed NA poly(age, 3, raw = TRUE)1 -0.09952 0.05102 -1.95 5947 0.05116 -0.1995 0.0004835
fixed NA poly(age, 3, raw = TRUE)2 0.003409 0.001821 1.872 5940 0.06123 -0.0001598 0.006978
fixed NA poly(age, 3, raw = TRUE)3 -0.00003628 0.00002062 -1.759 5927 0.07862 -0.0000767 0.000004144
fixed NA male -0.265 0.02627 -10.08 5942 1.002e-23 -0.3165 -0.2135
fixed NA count_birth_order2/2 0.01043 0.06822 0.153 5332 0.8784 -0.1233 0.1441
fixed NA count_birth_order1/3 -0.08321 0.05879 -1.415 5948 0.157 -0.1984 0.03202
fixed NA count_birth_order2/3 0.01868 0.06381 0.2928 5950 0.7697 -0.1064 0.1437
fixed NA count_birth_order3/3 -0.0109 0.07186 -0.1517 5951 0.8794 -0.1517 0.1299
fixed NA count_birth_order1/4 -0.05074 0.06955 -0.7296 5948 0.4657 -0.1871 0.08557
fixed NA count_birth_order2/4 -0.06652 0.07091 -0.938 5951 0.3483 -0.2055 0.07247
fixed NA count_birth_order3/4 -0.06716 0.07791 -0.862 5950 0.3887 -0.2199 0.08554
fixed NA count_birth_order4/4 -0.1452 0.08033 -1.808 5950 0.07073 -0.3026 0.01224
fixed NA count_birth_order1/5 -0.1287 0.08259 -1.559 5950 0.1191 -0.2906 0.03312
fixed NA count_birth_order2/5 -0.1947 0.08878 -2.193 5951 0.02835 -0.3687 -0.02069
fixed NA count_birth_order3/5 -0.1136 0.08636 -1.316 5950 0.1883 -0.2829 0.05564
fixed NA count_birth_order4/5 -0.123 0.08956 -1.373 5947 0.1698 -0.2985 0.05257
fixed NA count_birth_order5/5 0.06422 0.08981 0.7151 5946 0.4746 -0.1118 0.2403
fixed NA count_birth_order1/>5 -0.1769 0.07848 -2.255 5943 0.02418 -0.3308 -0.02313
fixed NA count_birth_order2/>5 -0.1904 0.08206 -2.32 5949 0.02038 -0.3512 -0.02953
fixed NA count_birth_order3/>5 -0.1052 0.08055 -1.306 5951 0.1916 -0.2631 0.05268
fixed NA count_birth_order4/>5 -0.07007 0.07755 -0.9036 5950 0.3663 -0.2221 0.08192
fixed NA count_birth_order5/>5 -0.001767 0.07974 -0.02216 5947 0.9823 -0.1581 0.1545
fixed NA count_birth_order>5/>5 -0.1002 0.05776 -1.736 5338 0.08268 -0.2135 0.01295
ran_pars mother_pidlink sd__(Intercept) 0.1906 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9952 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 17123 17197 -8551 17101 NA NA NA
12 17123 17203 -8549 17099 2.6 1 0.1069
16 17124 17231 -8546 17092 6.411 4 0.1705
26 17138 17312 -8543 17086 6.211 10 0.7972

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.072 0.4545 2.359 5795 0.01835 0.1814 1.963
fixed NA poly(age, 3, raw = TRUE)1 -0.0908 0.05157 -1.761 5792 0.07833 -0.1919 0.01027
fixed NA poly(age, 3, raw = TRUE)2 0.003071 0.00184 1.669 5785 0.09512 -0.0005349 0.006678
fixed NA poly(age, 3, raw = TRUE)3 -0.00003239 0.00002084 -1.555 5772 0.1201 -0.00007324 0.000008448
fixed NA male -0.2616 0.02657 -9.846 5789 1.075e-22 -0.3137 -0.2095
fixed NA sibling_count3 -0.04465 0.03971 -1.124 4468 0.2609 -0.1225 0.03318
fixed NA sibling_count4 -0.08125 0.04277 -1.899 3871 0.05759 -0.1651 0.002591
fixed NA sibling_count5 -0.115 0.05 -2.3 3209 0.02154 -0.213 -0.01698
fixed NA sibling_count>5 -0.1278 0.04315 -2.963 2877 0.003073 -0.2124 -0.04327
ran_pars mother_pidlink sd__(Intercept) 0.1898 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9926 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.06 0.4544 2.334 5795 0.01964 0.1698 1.951
fixed NA birth_order 0.01785 0.008858 2.016 5372 0.0439 0.000492 0.03521
fixed NA poly(age, 3, raw = TRUE)1 -0.09181 0.05156 -1.781 5791 0.07501 -0.1929 0.009241
fixed NA poly(age, 3, raw = TRUE)2 0.003073 0.00184 1.671 5784 0.09484 -0.0005322 0.006679
fixed NA poly(age, 3, raw = TRUE)3 -0.00003172 0.00002084 -1.522 5773 0.128 -0.00007256 0.000009117
fixed NA male -0.262 0.02656 -9.864 5787 9.017e-23 -0.3141 -0.2099
fixed NA sibling_count3 -0.05323 0.03994 -1.333 4462 0.1827 -0.1315 0.02505
fixed NA sibling_count4 -0.1011 0.0439 -2.303 3868 0.02135 -0.1871 -0.01505
fixed NA sibling_count5 -0.1465 0.0524 -2.795 3260 0.005213 -0.2492 -0.04378
fixed NA sibling_count>5 -0.1938 0.05419 -3.576 3483 0.0003539 -0.3 -0.08757
ran_pars mother_pidlink sd__(Intercept) 0.1929 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9917 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.044 0.4546 2.297 5790 0.02165 0.1532 1.935
fixed NA poly(age, 3, raw = TRUE)1 -0.08873 0.05154 -1.722 5786 0.0852 -0.1898 0.01229
fixed NA poly(age, 3, raw = TRUE)2 0.002964 0.001839 1.612 5778 0.1071 -0.0006406 0.006569
fixed NA poly(age, 3, raw = TRUE)3 -0.00003055 0.00002083 -1.466 5766 0.1426 -0.00007138 0.00001029
fixed NA male -0.2626 0.02655 -9.892 5783 6.841e-23 -0.3147 -0.2106
fixed NA sibling_count3 -0.05612 0.04085 -1.374 4661 0.1695 -0.1362 0.02394
fixed NA sibling_count4 -0.124 0.04582 -2.706 4240 0.006837 -0.2138 -0.03419
fixed NA sibling_count5 -0.1948 0.05506 -3.537 3704 0.0004094 -0.3027 -0.08684
fixed NA sibling_count>5 -0.2001 0.05603 -3.572 3826 0.0003583 -0.31 -0.09033
fixed NA birth_order_nonlinear2 0.04114 0.03439 1.196 5008 0.2317 -0.02627 0.1086
fixed NA birth_order_nonlinear3 0.05162 0.04243 1.217 5240 0.2238 -0.03154 0.1348
fixed NA birth_order_nonlinear4 0.1592 0.05384 2.957 5413 0.003124 0.05366 0.2647
fixed NA birth_order_nonlinear5 0.2166 0.06823 3.175 5373 0.001507 0.0829 0.3503
fixed NA birth_order_nonlinear>5 0.04953 0.06681 0.7413 5756 0.4585 -0.08142 0.1805
ran_pars mother_pidlink sd__(Intercept) 0.1887 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9919 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.015 0.4558 2.227 5779 0.026 0.1216 1.908
fixed NA poly(age, 3, raw = TRUE)1 -0.08443 0.05168 -1.634 5776 0.1024 -0.1857 0.01686
fixed NA poly(age, 3, raw = TRUE)2 0.002813 0.001844 1.525 5768 0.1273 -0.0008021 0.006427
fixed NA poly(age, 3, raw = TRUE)3 -0.00002887 0.0000209 -1.382 5755 0.1672 -0.00006982 0.00001209
fixed NA male -0.2616 0.02658 -9.842 5773 1.114e-22 -0.3137 -0.2095
fixed NA count_birth_order2/2 0.01484 0.06064 0.2447 5095 0.8067 -0.104 0.1337
fixed NA count_birth_order1/3 -0.09202 0.05348 -1.721 5777 0.08537 -0.1968 0.0128
fixed NA count_birth_order2/3 0.009075 0.05919 0.1533 5781 0.8781 -0.1069 0.1251
fixed NA count_birth_order3/3 -0.006927 0.06507 -0.1065 5780 0.9152 -0.1345 0.1206
fixed NA count_birth_order1/4 -0.1042 0.06656 -1.565 5778 0.1176 -0.2346 0.02629
fixed NA count_birth_order2/4 -0.1136 0.06851 -1.658 5781 0.09733 -0.2479 0.02067
fixed NA count_birth_order3/4 -0.08828 0.07183 -1.229 5779 0.2191 -0.2291 0.0525
fixed NA count_birth_order4/4 0.02013 0.07593 0.2651 5778 0.7909 -0.1287 0.169
fixed NA count_birth_order1/5 -0.1585 0.08983 -1.765 5780 0.07762 -0.3346 0.01752
fixed NA count_birth_order2/5 -0.151 0.09939 -1.519 5780 0.1287 -0.3458 0.04379
fixed NA count_birth_order3/5 -0.1459 0.09485 -1.538 5779 0.124 -0.3318 0.04
fixed NA count_birth_order4/5 -0.05101 0.09137 -0.5583 5779 0.5767 -0.2301 0.1281
fixed NA count_birth_order5/5 -0.05376 0.09711 -0.5536 5776 0.5799 -0.2441 0.1366
fixed NA count_birth_order1/>5 -0.2499 0.09145 -2.732 5775 0.006309 -0.4291 -0.07063
fixed NA count_birth_order2/>5 -0.1872 0.09072 -2.063 5778 0.03912 -0.365 -0.009383
fixed NA count_birth_order3/>5 -0.1664 0.08997 -1.85 5781 0.06437 -0.3428 0.009894
fixed NA count_birth_order4/>5 -0.03704 0.08803 -0.4208 5779 0.6739 -0.2096 0.1355
fixed NA count_birth_order5/>5 0.04899 0.0809 0.6055 5778 0.5449 -0.1096 0.2076
fixed NA count_birth_order>5/>5 -0.1598 0.05974 -2.675 4968 0.007497 -0.2769 -0.04272
ran_pars mother_pidlink sd__(Intercept) 0.1888 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9924 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16605 16679 -8292 16583 NA NA NA
12 16603 16683 -8290 16579 4.058 1 0.04397
16 16600 16706 -8284 16568 11.43 4 0.0221
26 16617 16790 -8282 16565 3.206 10 0.9761

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Neuroticism

birthorder <- birthorder %>% mutate(outcome = big5_neu)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5805 0.1576 3.684 13711 0.0002301 0.2717 0.8893
fixed NA poly(age, 3, raw = TRUE)1 -0.01912 0.01509 -1.267 13603 0.2052 -0.04871 0.01046
fixed NA poly(age, 3, raw = TRUE)2 0.00009704 0.0004437 0.2187 13429 0.8269 -0.0007726 0.0009666
fixed NA poly(age, 3, raw = TRUE)3 0.0000001933 0.000004082 0.04736 13256 0.9622 -0.000007808 0.000008194
fixed NA male -0.2605 0.01664 -15.66 13806 9.038e-55 -0.2931 -0.2279
fixed NA sibling_count3 -0.009417 0.03319 -0.2838 10517 0.7766 -0.07446 0.05563
fixed NA sibling_count4 -0.002559 0.03413 -0.07498 9566 0.9402 -0.06944 0.06433
fixed NA sibling_count5 -0.03946 0.03539 -1.115 8500 0.2649 -0.1088 0.02991
fixed NA sibling_count>5 0.02614 0.02785 0.9384 9661 0.3481 -0.02846 0.08073
ran_pars mother_pidlink sd__(Intercept) 0.2846 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9435 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.58 0.1576 3.681 13713 0.0002335 0.2711 0.8888
fixed NA birth_order -0.001117 0.003475 -0.3215 11756 0.7479 -0.007928 0.005694
fixed NA poly(age, 3, raw = TRUE)1 -0.01879 0.01513 -1.242 13587 0.2143 -0.04844 0.01087
fixed NA poly(age, 3, raw = TRUE)2 0.00008512 0.0004452 0.1912 13370 0.8484 -0.0007875 0.0009577
fixed NA poly(age, 3, raw = TRUE)3 0.000000302 0.000004096 0.07372 13174 0.9412 -0.000007726 0.00000833
fixed NA male -0.2604 0.01664 -15.65 13804 9.417e-55 -0.293 -0.2278
fixed NA sibling_count3 -0.009148 0.0332 -0.2755 10529 0.7829 -0.07422 0.05592
fixed NA sibling_count4 -0.001769 0.03422 -0.05169 9624 0.9588 -0.06883 0.0653
fixed NA sibling_count5 -0.03809 0.03565 -1.069 8603 0.2853 -0.108 0.03178
fixed NA sibling_count>5 0.0304 0.03085 0.9854 10648 0.3245 -0.03006 0.09086
ran_pars mother_pidlink sd__(Intercept) 0.2849 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9435 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5764 0.158 3.648 13716 0.0002652 0.2667 0.8861
fixed NA poly(age, 3, raw = TRUE)1 -0.01814 0.01514 -1.199 13597 0.2307 -0.04781 0.01152
fixed NA poly(age, 3, raw = TRUE)2 0.00005994 0.0004453 0.1346 13381 0.8929 -0.0008129 0.0009328
fixed NA poly(age, 3, raw = TRUE)3 0.0000005424 0.000004098 0.1324 13174 0.8947 -0.000007489 0.000008574
fixed NA male -0.2604 0.01664 -15.65 13799 1.021e-54 -0.293 -0.2278
fixed NA sibling_count3 -0.007709 0.0337 -0.2287 10868 0.8191 -0.07376 0.05834
fixed NA sibling_count4 -0.001011 0.03525 -0.02867 10345 0.9771 -0.0701 0.06808
fixed NA sibling_count5 -0.03826 0.03713 -1.031 9574 0.3027 -0.111 0.0345
fixed NA sibling_count>5 0.04189 0.03251 1.288 11764 0.1976 -0.02183 0.1056
fixed NA birth_order_nonlinear2 -0.002359 0.02426 -0.09724 12739 0.9225 -0.0499 0.04518
fixed NA birth_order_nonlinear3 -0.01075 0.02863 -0.3755 12588 0.7073 -0.06686 0.04536
fixed NA birth_order_nonlinear4 -0.0006682 0.03261 -0.02049 12677 0.9836 -0.06457 0.06324
fixed NA birth_order_nonlinear5 0.0002819 0.03708 0.007603 12741 0.9939 -0.0724 0.07296
fixed NA birth_order_nonlinear>5 -0.03676 0.0306 -1.202 13920 0.2295 -0.09673 0.0232
ran_pars mother_pidlink sd__(Intercept) 0.2852 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9434 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5674 0.1587 3.575 13715 0.0003515 0.2563 0.8784
fixed NA poly(age, 3, raw = TRUE)1 -0.01774 0.01514 -1.172 13588 0.2414 -0.04741 0.01194
fixed NA poly(age, 3, raw = TRUE)2 0.00004913 0.0004455 0.1103 13366 0.9122 -0.000824 0.0009222
fixed NA poly(age, 3, raw = TRUE)3 0.0000006254 0.000004099 0.1525 13152 0.8788 -0.000007409 0.00000866
fixed NA male -0.2604 0.01664 -15.64 13789 1.073e-54 -0.293 -0.2278
fixed NA count_birth_order2/2 0.01066 0.04715 0.2261 12596 0.8211 -0.08176 0.1031
fixed NA count_birth_order1/3 0.0004386 0.04446 0.009865 13825 0.9921 -0.08671 0.08758
fixed NA count_birth_order2/3 -0.00866 0.04971 -0.1742 13864 0.8617 -0.1061 0.08877
fixed NA count_birth_order3/3 -0.01581 0.05567 -0.2839 13894 0.7765 -0.1249 0.09331
fixed NA count_birth_order1/4 -0.02016 0.05076 -0.3971 13867 0.6913 -0.1197 0.07934
fixed NA count_birth_order2/4 0.02738 0.05339 0.5129 13879 0.608 -0.07725 0.132
fixed NA count_birth_order3/4 0.01082 0.058 0.1866 13897 0.852 -0.1029 0.1245
fixed NA count_birth_order4/4 -0.01496 0.0614 -0.2437 13906 0.8075 -0.1353 0.1054
fixed NA count_birth_order1/5 0.01294 0.0576 0.2247 13895 0.8222 -0.09994 0.1258
fixed NA count_birth_order2/5 -0.0134 0.06058 -0.2212 13905 0.8249 -0.1321 0.1053
fixed NA count_birth_order3/5 -0.03575 0.06218 -0.5749 13907 0.5654 -0.1576 0.08612
fixed NA count_birth_order4/5 -0.0666 0.06586 -1.011 13910 0.312 -0.1957 0.06249
fixed NA count_birth_order5/5 -0.1109 0.06733 -1.648 13910 0.09939 -0.2429 0.02101
fixed NA count_birth_order1/>5 0.04369 0.04651 0.9394 13909 0.3476 -0.04747 0.1348
fixed NA count_birth_order2/>5 0.009542 0.04797 0.1989 13910 0.8423 -0.08448 0.1036
fixed NA count_birth_order3/>5 0.02378 0.047 0.5059 13910 0.613 -0.06834 0.1159
fixed NA count_birth_order4/>5 0.06431 0.04606 1.396 13910 0.1626 -0.02596 0.1546
fixed NA count_birth_order5/>5 0.07289 0.0464 1.571 13909 0.1162 -0.01805 0.1638
fixed NA count_birth_order>5/>5 0.009809 0.03612 0.2716 12651 0.786 -0.06099 0.08061
ran_pars mother_pidlink sd__(Intercept) 0.2849 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9437 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 39076 39159 -19527 39054 NA NA NA
12 39078 39168 -19527 39054 0.1024 1 0.749
16 39084 39205 -19526 39052 1.999 4 0.736
26 39098 39294 -19523 39046 6.132 10 0.804

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3543 0.4352 -0.814 5906 0.4157 -1.207 0.4988
fixed NA poly(age, 3, raw = TRUE)1 0.09127 0.04938 1.848 5910 0.06462 -0.005517 0.1881
fixed NA poly(age, 3, raw = TRUE)2 -0.004075 0.001762 -2.313 5913 0.02077 -0.007529 -0.0006216
fixed NA poly(age, 3, raw = TRUE)3 0.00004695 0.00001995 2.353 5915 0.01865 0.000007843 0.00008605
fixed NA male -0.2664 0.02545 -10.47 5874 2.056e-25 -0.3163 -0.2165
fixed NA sibling_count3 0.01865 0.03952 0.4719 4540 0.6371 -0.05881 0.09611
fixed NA sibling_count4 0.02037 0.04245 0.4798 3988 0.6314 -0.06283 0.1036
fixed NA sibling_count5 0.07006 0.04833 1.449 3532 0.1473 -0.02467 0.1648
fixed NA sibling_count>5 0.1134 0.04237 2.676 3266 0.007478 0.03036 0.1965
ran_pars mother_pidlink sd__(Intercept) 0.2875 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9381 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3506 0.4353 -0.8054 5905 0.4206 -1.204 0.5026
fixed NA birth_order -0.004386 0.008375 -0.5237 5712 0.6005 -0.0208 0.01203
fixed NA poly(age, 3, raw = TRUE)1 0.09146 0.04939 1.852 5909 0.06409 -0.005338 0.1883
fixed NA poly(age, 3, raw = TRUE)2 -0.004074 0.001762 -2.312 5912 0.02081 -0.007528 -0.0006205
fixed NA poly(age, 3, raw = TRUE)3 0.00004677 0.00001996 2.343 5914 0.01914 0.000007654 0.00008588
fixed NA male -0.2662 0.02546 -10.46 5874 2.257e-25 -0.3161 -0.2163
fixed NA sibling_count3 0.02077 0.03973 0.5227 4543 0.6012 -0.0571 0.09864
fixed NA sibling_count4 0.02537 0.04351 0.583 3990 0.5599 -0.05992 0.1107
fixed NA sibling_count5 0.07826 0.05081 1.54 3602 0.1236 -0.02133 0.1778
fixed NA sibling_count>5 0.1299 0.05275 2.462 3776 0.01386 0.02648 0.2332
ran_pars mother_pidlink sd__(Intercept) 0.2875 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9382 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3461 0.4357 -0.7943 5904 0.4271 -1.2 0.5079
fixed NA poly(age, 3, raw = TRUE)1 0.09076 0.04938 1.838 5906 0.06614 -0.006033 0.1875
fixed NA poly(age, 3, raw = TRUE)2 -0.00404 0.001762 -2.293 5909 0.0219 -0.007494 -0.0005863
fixed NA poly(age, 3, raw = TRUE)3 0.00004615 0.00001996 2.312 5910 0.02079 0.000007034 0.00008527
fixed NA male -0.2659 0.02544 -10.45 5870 2.41e-25 -0.3158 -0.216
fixed NA sibling_count3 0.002937 0.04055 0.07242 4732 0.9423 -0.07654 0.08241
fixed NA sibling_count4 0.02674 0.04526 0.5908 4336 0.5547 -0.06196 0.1154
fixed NA sibling_count5 0.09421 0.05348 1.762 4065 0.07822 -0.01061 0.199
fixed NA sibling_count>5 0.1447 0.05434 2.662 4069 0.007796 0.03815 0.2512
fixed NA birth_order_nonlinear2 -0.01411 0.0331 -0.4264 5070 0.6698 -0.07898 0.05076
fixed NA birth_order_nonlinear3 0.06996 0.04079 1.715 5302 0.08636 -0.009982 0.1499
fixed NA birth_order_nonlinear4 -0.1062 0.05038 -2.109 5452 0.03501 -0.205 -0.007499
fixed NA birth_order_nonlinear5 -0.0758 0.06294 -1.204 5358 0.2285 -0.1992 0.04757
fixed NA birth_order_nonlinear>5 -0.0365 0.06279 -0.5813 5909 0.5611 -0.1596 0.08657
ran_pars mother_pidlink sd__(Intercept) 0.2848 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9382 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.4027 0.4364 -0.9229 5894 0.3561 -1.258 0.4525
fixed NA poly(age, 3, raw = TRUE)1 0.09799 0.04946 1.981 5896 0.04762 0.001049 0.1949
fixed NA poly(age, 3, raw = TRUE)2 -0.004291 0.001765 -2.431 5898 0.0151 -0.00775 -0.000831
fixed NA poly(age, 3, raw = TRUE)3 0.0000489 0.00002 2.445 5900 0.0145 0.000009708 0.00008809
fixed NA male -0.2654 0.02545 -10.43 5858 2.97e-25 -0.3153 -0.2156
fixed NA count_birth_order2/2 -0.039 0.05976 -0.6525 5248 0.5141 -0.1561 0.07814
fixed NA count_birth_order1/3 -0.04149 0.0525 -0.7903 5886 0.4294 -0.1444 0.06141
fixed NA count_birth_order2/3 0.01587 0.05738 0.2765 5897 0.7822 -0.09659 0.1283
fixed NA count_birth_order3/3 0.08473 0.06415 1.321 5900 0.1866 -0.041 0.2105
fixed NA count_birth_order1/4 0.04092 0.0642 0.6374 5892 0.5239 -0.08491 0.1668
fixed NA count_birth_order2/4 0.04203 0.06646 0.6324 5900 0.5271 -0.08823 0.1723
fixed NA count_birth_order3/4 0.0375 0.07026 0.5337 5897 0.5936 -0.1002 0.1752
fixed NA count_birth_order4/4 -0.1151 0.07304 -1.576 5896 0.1151 -0.2583 0.02805
fixed NA count_birth_order1/5 0.2044 0.08723 2.344 5900 0.01914 0.03346 0.3754
fixed NA count_birth_order2/5 -0.11 0.09341 -1.177 5893 0.2391 -0.2931 0.0731
fixed NA count_birth_order3/5 0.2414 0.08757 2.757 5891 0.005853 0.06979 0.413
fixed NA count_birth_order4/5 -0.0007861 0.08435 -0.00932 5894 0.9926 -0.1661 0.1645
fixed NA count_birth_order5/5 -0.06552 0.08778 -0.7464 5888 0.4555 -0.2376 0.1065
fixed NA count_birth_order1/>5 0.07957 0.08655 0.9194 5900 0.3579 -0.09006 0.2492
fixed NA count_birth_order2/>5 0.1312 0.0857 1.531 5898 0.1259 -0.03679 0.2991
fixed NA count_birth_order3/>5 0.1658 0.08586 1.93 5887 0.0536 -0.002535 0.334
fixed NA count_birth_order4/>5 0.04447 0.08091 0.5497 5884 0.5826 -0.1141 0.2031
fixed NA count_birth_order5/>5 0.1124 0.07646 1.47 5883 0.1417 -0.03749 0.2622
fixed NA count_birth_order>5/>5 0.09957 0.05735 1.736 5353 0.08261 -0.01284 0.212
ran_pars mother_pidlink sd__(Intercept) 0.2864 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9374 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16578 16652 -8278 16556 NA NA NA
12 16580 16660 -8278 16556 0.2748 1 0.6001
16 16576 16683 -8272 16544 12.34 4 0.01502
26 16582 16755 -8265 16530 14.13 10 0.1673

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3839 0.4336 -0.8853 5958 0.376 -1.234 0.466
fixed NA poly(age, 3, raw = TRUE)1 0.09637 0.04922 1.958 5961 0.05029 -0.0001004 0.1928
fixed NA poly(age, 3, raw = TRUE)2 -0.004224 0.001757 -2.405 5964 0.01621 -0.007667 -0.0007815
fixed NA poly(age, 3, raw = TRUE)3 0.00004839 0.00001989 2.432 5966 0.01503 0.000009396 0.00008738
fixed NA male -0.2706 0.02533 -10.68 5925 2.202e-26 -0.3202 -0.2209
fixed NA sibling_count3 -0.001241 0.04271 -0.02905 4700 0.9768 -0.08496 0.08248
fixed NA sibling_count4 -0.001944 0.04493 -0.04327 4282 0.9655 -0.09 0.08611
fixed NA sibling_count5 -0.03667 0.04794 -0.765 3824 0.4443 -0.1306 0.05729
fixed NA sibling_count>5 0.0932 0.04204 2.217 3909 0.0267 0.0108 0.1756
ran_pars mother_pidlink sd__(Intercept) 0.2852 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9382 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3782 0.4337 -0.8721 5957 0.3832 -1.228 0.4718
fixed NA birth_order -0.004982 0.00729 -0.6834 5481 0.4944 -0.01927 0.009306
fixed NA poly(age, 3, raw = TRUE)1 0.0964 0.04922 1.958 5960 0.05022 -0.00007259 0.1929
fixed NA poly(age, 3, raw = TRUE)2 -0.004217 0.001757 -2.4 5963 0.01641 -0.00766 -0.0007737
fixed NA poly(age, 3, raw = TRUE)3 0.00004811 0.0000199 2.418 5965 0.01565 0.000009106 0.00008711
fixed NA male -0.2704 0.02534 -10.67 5925 2.389e-26 -0.3201 -0.2207
fixed NA sibling_count3 0.00115 0.04286 0.02684 4698 0.9786 -0.08285 0.08515
fixed NA sibling_count4 0.003495 0.04563 0.0766 4266 0.9389 -0.08594 0.09293
fixed NA sibling_count5 -0.02809 0.04956 -0.5667 3829 0.571 -0.1252 0.06905
fixed NA sibling_count>5 0.1114 0.04977 2.238 4182 0.02526 0.01385 0.2089
ran_pars mother_pidlink sd__(Intercept) 0.2853 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9382 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3631 0.434 -0.8366 5955 0.4028 -1.214 0.4876
fixed NA poly(age, 3, raw = TRUE)1 0.09484 0.04922 1.927 5958 0.05405 -0.001633 0.1913
fixed NA poly(age, 3, raw = TRUE)2 -0.004152 0.001757 -2.363 5960 0.01815 -0.007595 -0.0007085
fixed NA poly(age, 3, raw = TRUE)3 0.00004717 0.0000199 2.37 5961 0.01782 0.000008162 0.00008618
fixed NA male -0.2712 0.02533 -10.71 5921 1.678e-26 -0.3208 -0.2215
fixed NA sibling_count3 -0.01381 0.04365 -0.3164 4850 0.7517 -0.09935 0.07173
fixed NA sibling_count4 -0.007871 0.04728 -0.1665 4558 0.8678 -0.1005 0.08479
fixed NA sibling_count5 -0.02175 0.05201 -0.4181 4241 0.6759 -0.1237 0.0802
fixed NA sibling_count>5 0.1204 0.05136 2.344 4492 0.0191 0.01975 0.2211
fixed NA birth_order_nonlinear2 -0.02501 0.03368 -0.7427 5200 0.4577 -0.09103 0.041
fixed NA birth_order_nonlinear3 0.05665 0.04062 1.395 5424 0.1632 -0.02297 0.1363
fixed NA birth_order_nonlinear4 -0.0316 0.04884 -0.6469 5570 0.5177 -0.1273 0.06413
fixed NA birth_order_nonlinear5 -0.1226 0.05993 -2.045 5545 0.04086 -0.24 -0.005124
fixed NA birth_order_nonlinear>5 -0.04813 0.05599 -0.8595 5926 0.3901 -0.1579 0.06162
ran_pars mother_pidlink sd__(Intercept) 0.2834 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9383 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3939 0.4347 -0.906 5946 0.365 -1.246 0.4582
fixed NA poly(age, 3, raw = TRUE)1 0.09802 0.04928 1.989 5948 0.04674 0.001436 0.1946
fixed NA poly(age, 3, raw = TRUE)2 -0.004261 0.001759 -2.422 5950 0.01547 -0.007709 -0.0008125
fixed NA poly(age, 3, raw = TRUE)3 0.00004832 0.00001993 2.424 5951 0.01539 0.000009247 0.00008738
fixed NA male -0.2715 0.02534 -10.71 5911 1.53e-26 -0.3212 -0.2218
fixed NA count_birth_order2/2 -0.01787 0.06539 -0.2732 5358 0.7847 -0.146 0.1103
fixed NA count_birth_order1/3 -0.02834 0.05683 -0.4987 5938 0.618 -0.1397 0.08304
fixed NA count_birth_order2/3 -0.04075 0.06165 -0.6609 5948 0.5087 -0.1616 0.08008
fixed NA count_birth_order3/3 0.08512 0.0694 1.227 5951 0.22 -0.05089 0.2211
fixed NA count_birth_order1/4 -0.05575 0.06722 -0.8294 5944 0.4069 -0.1875 0.07599
fixed NA count_birth_order2/4 -0.006205 0.06851 -0.09057 5950 0.9278 -0.1405 0.1281
fixed NA count_birth_order3/4 0.09585 0.07522 1.274 5949 0.2026 -0.05157 0.2433
fixed NA count_birth_order4/4 -0.0416 0.07755 -0.5364 5948 0.5917 -0.1936 0.1104
fixed NA count_birth_order1/5 0.116 0.07979 1.454 5950 0.1459 -0.04034 0.2724
fixed NA count_birth_order2/5 -0.04191 0.08573 -0.4888 5948 0.625 -0.2099 0.1261
fixed NA count_birth_order3/5 0.005031 0.08338 0.06034 5947 0.9519 -0.1584 0.1684
fixed NA count_birth_order4/5 -0.08346 0.08643 -0.9656 5940 0.3343 -0.2529 0.08594
fixed NA count_birth_order5/5 -0.249 0.08667 -2.873 5939 0.004081 -0.4189 -0.07913
fixed NA count_birth_order1/>5 0.1245 0.07584 1.642 5949 0.1006 -0.0241 0.2732
fixed NA count_birth_order2/>5 0.06323 0.07926 0.7977 5950 0.4251 -0.09212 0.2186
fixed NA count_birth_order3/>5 0.1071 0.07777 1.377 5944 0.1687 -0.04536 0.2595
fixed NA count_birth_order4/>5 0.1166 0.07485 1.558 5942 0.1193 -0.03008 0.2633
fixed NA count_birth_order5/>5 0.07651 0.07694 0.9944 5930 0.3201 -0.07429 0.2273
fixed NA count_birth_order>5/>5 0.075 0.05618 1.335 5485 0.182 -0.03512 0.1851
ran_pars mother_pidlink sd__(Intercept) 0.2831 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9382 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16714 16788 -8346 16692 NA NA NA
12 16716 16796 -8346 16692 0.4677 1 0.4941
16 16714 16821 -8341 16682 9.387 4 0.05213
26 16723 16897 -8335 16671 11.66 10 0.3085

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3119 0.4401 -0.7089 5790 0.4784 -1.174 0.5506
fixed NA poly(age, 3, raw = TRUE)1 0.08493 0.04995 1.7 5793 0.08912 -0.01297 0.1828
fixed NA poly(age, 3, raw = TRUE)2 -0.003823 0.001783 -2.144 5795 0.03206 -0.007317 -0.0003285
fixed NA poly(age, 3, raw = TRUE)3 0.00004382 0.0000202 2.17 5796 0.03008 0.000004235 0.00008341
fixed NA male -0.2671 0.0257 -10.39 5761 4.477e-25 -0.3175 -0.2167
fixed NA sibling_count3 0.02263 0.03892 0.5814 4439 0.561 -0.05366 0.09891
fixed NA sibling_count4 0.02637 0.04206 0.6269 3907 0.5308 -0.05607 0.1088
fixed NA sibling_count5 0.06156 0.04935 1.247 3337 0.2123 -0.03517 0.1583
fixed NA sibling_count>5 0.1362 0.04268 3.191 3077 0.001431 0.05255 0.2198
ran_pars mother_pidlink sd__(Intercept) 0.2779 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9399 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.31 0.4401 -0.7044 5789 0.4812 -1.173 0.5526
fixed NA birth_order -0.002816 0.008623 -0.3265 5619 0.744 -0.01972 0.01409
fixed NA poly(age, 3, raw = TRUE)1 0.0851 0.04996 1.703 5792 0.08855 -0.01282 0.183
fixed NA poly(age, 3, raw = TRUE)2 -0.003823 0.001783 -2.144 5794 0.03204 -0.007318 -0.0003289
fixed NA poly(age, 3, raw = TRUE)3 0.00004372 0.0000202 2.164 5795 0.0305 0.000004122 0.00008331
fixed NA male -0.267 0.0257 -10.39 5760 4.66e-25 -0.3174 -0.2166
fixed NA sibling_count3 0.02399 0.03915 0.6129 4440 0.54 -0.05273 0.1007
fixed NA sibling_count4 0.02953 0.04316 0.6841 3920 0.494 -0.05507 0.1141
fixed NA sibling_count5 0.06659 0.0517 1.288 3405 0.1978 -0.03474 0.1679
fixed NA sibling_count>5 0.1467 0.05338 2.748 3686 0.006033 0.04204 0.2513
ran_pars mother_pidlink sd__(Intercept) 0.2779 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.94 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3089 0.4404 -0.7015 5787 0.483 -1.172 0.5543
fixed NA poly(age, 3, raw = TRUE)1 0.08496 0.04995 1.701 5789 0.08902 -0.01294 0.1829
fixed NA poly(age, 3, raw = TRUE)2 -0.003814 0.001783 -2.139 5791 0.03244 -0.007308 -0.00032
fixed NA poly(age, 3, raw = TRUE)3 0.00004349 0.0000202 2.153 5791 0.03138 0.000003895 0.00008309
fixed NA male -0.2661 0.02569 -10.36 5757 6.318e-25 -0.3165 -0.2158
fixed NA sibling_count3 0.00615 0.04 0.1538 4631 0.8778 -0.07224 0.08454
fixed NA sibling_count4 0.03058 0.04497 0.68 4267 0.4966 -0.05756 0.1187
fixed NA sibling_count5 0.08032 0.05419 1.482 3821 0.1384 -0.02589 0.1865
fixed NA sibling_count>5 0.1524 0.05509 2.766 3999 0.005705 0.04439 0.2603
fixed NA birth_order_nonlinear2 -0.01162 0.03304 -0.3517 4967 0.7251 -0.07639 0.05314
fixed NA birth_order_nonlinear3 0.0701 0.04082 1.717 5177 0.086 -0.00991 0.1501
fixed NA birth_order_nonlinear4 -0.1025 0.05187 -1.975 5336 0.04827 -0.2041 -0.0008038
fixed NA birth_order_nonlinear5 -0.06008 0.06569 -0.9146 5266 0.3604 -0.1888 0.06867
fixed NA birth_order_nonlinear>5 -0.008558 0.06479 -0.1321 5791 0.8949 -0.1355 0.1184
ran_pars mother_pidlink sd__(Intercept) 0.2758 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9399 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.3435 0.4413 -0.7782 5778 0.4365 -1.208 0.5216
fixed NA poly(age, 3, raw = TRUE)1 0.08974 0.05005 1.793 5779 0.07301 -0.008352 0.1878
fixed NA poly(age, 3, raw = TRUE)2 -0.003982 0.001787 -2.229 5781 0.02587 -0.007484 -0.0004801
fixed NA poly(age, 3, raw = TRUE)3 0.00004536 0.00002025 2.24 5781 0.02512 0.000005672 0.00008504
fixed NA male -0.2651 0.02571 -10.31 5745 1.02e-24 -0.3155 -0.2147
fixed NA count_birth_order2/2 -0.03673 0.05826 -0.6303 5107 0.5285 -0.1509 0.07747
fixed NA count_birth_order1/3 -0.03504 0.05183 -0.6761 5768 0.499 -0.1366 0.06654
fixed NA count_birth_order2/3 0.02112 0.05733 0.3685 5780 0.7125 -0.09124 0.1335
fixed NA count_birth_order3/3 0.08289 0.063 1.316 5780 0.1883 -0.04058 0.2064
fixed NA count_birth_order1/4 0.03566 0.06449 0.5529 5777 0.5804 -0.09074 0.1621
fixed NA count_birth_order2/4 0.05259 0.06634 0.7926 5781 0.428 -0.07745 0.1826
fixed NA count_birth_order3/4 0.06513 0.06952 0.9368 5777 0.3489 -0.07113 0.2014
fixed NA count_birth_order4/4 -0.1268 0.07348 -1.725 5775 0.0846 -0.2708 0.01727
fixed NA count_birth_order1/5 0.1824 0.087 2.097 5781 0.03602 0.01193 0.353
fixed NA count_birth_order2/5 -0.1091 0.09619 -1.135 5774 0.2566 -0.2977 0.0794
fixed NA count_birth_order3/5 0.1727 0.09178 1.882 5771 0.05994 -0.007195 0.3526
fixed NA count_birth_order4/5 0.01715 0.08843 0.1939 5774 0.8462 -0.1562 0.1905
fixed NA count_birth_order5/5 -0.05352 0.09396 -0.5696 5769 0.569 -0.2377 0.1306
fixed NA count_birth_order1/>5 0.09742 0.08857 1.1 5781 0.2714 -0.07617 0.271
fixed NA count_birth_order2/>5 0.1182 0.08785 1.346 5779 0.1785 -0.05396 0.2904
fixed NA count_birth_order3/>5 0.1982 0.08707 2.276 5768 0.02285 0.02756 0.3689
fixed NA count_birth_order4/>5 0.06053 0.08517 0.7107 5759 0.4773 -0.1064 0.2275
fixed NA count_birth_order5/>5 0.1239 0.07828 1.582 5764 0.1136 -0.02957 0.2773
fixed NA count_birth_order>5/>5 0.1351 0.05831 2.316 5172 0.02058 0.02078 0.2493
ran_pars mother_pidlink sd__(Intercept) 0.2761 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9398 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16235 16308 -8106 16213 NA NA NA
12 16237 16317 -8106 16213 0.1071 1 0.7435
16 16234 16340 -8101 16202 11.14 4 0.02506
26 16243 16416 -8096 16191 10.72 10 0.3799

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Conscientiousness

birthorder <- birthorder %>% mutate(outcome = big5_con)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.384 0.1564 -8.846 13621 1.016e-18 -1.69 -1.077
fixed NA poly(age, 3, raw = TRUE)1 0.07934 0.01497 5.299 13475 0.0000001185 0.04999 0.1087
fixed NA poly(age, 3, raw = TRUE)2 -0.001195 0.0004398 -2.718 13274 0.006579 -0.002057 -0.0003333
fixed NA poly(age, 3, raw = TRUE)3 0.000005148 0.000004043 1.273 13095 0.203 -0.000002777 0.00001307
fixed NA male 0.0443 0.01659 2.669 13887 0.00761 0.01177 0.07682
fixed NA sibling_count3 -0.01129 0.03263 -0.346 10656 0.7293 -0.07525 0.05267
fixed NA sibling_count4 -0.01053 0.03347 -0.3145 9594 0.7531 -0.07613 0.05508
fixed NA sibling_count5 -0.0000886 0.03461 -0.00256 8380 0.998 -0.06792 0.06775
fixed NA sibling_count>5 0.02139 0.02733 0.7829 9670 0.4337 -0.03217 0.07495
ran_pars mother_pidlink sd__(Intercept) 0.2052 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9578 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.384 0.1564 -8.85 13624 9.775e-19 -1.691 -1.078
fixed NA birth_order -0.001557 0.003422 -0.4549 10419 0.6492 -0.008263 0.00515
fixed NA poly(age, 3, raw = TRUE)1 0.0798 0.01501 5.317 13457 0.0000001072 0.05038 0.1092
fixed NA poly(age, 3, raw = TRUE)2 -0.001211 0.0004412 -2.745 13209 0.006056 -0.002076 -0.0003464
fixed NA poly(age, 3, raw = TRUE)3 0.000005292 0.000004056 1.305 13010 0.192 -0.000002658 0.00001324
fixed NA male 0.04434 0.0166 2.672 13886 0.007552 0.01181 0.07687
fixed NA sibling_count3 -0.01089 0.03265 -0.3337 10671 0.7386 -0.07488 0.05309
fixed NA sibling_count4 -0.009402 0.03357 -0.2801 9650 0.7794 -0.07519 0.05639
fixed NA sibling_count5 0.00183 0.03487 0.05247 8475 0.9582 -0.06652 0.07017
fixed NA sibling_count>5 0.02738 0.03034 0.9025 10573 0.3668 -0.03208 0.08683
ran_pars mother_pidlink sd__(Intercept) 0.2055 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9578 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.373 0.1568 -8.753 13630 2.309e-18 -1.68 -1.066
fixed NA poly(age, 3, raw = TRUE)1 0.07988 0.01501 5.32 13469 0.0000001051 0.05045 0.1093
fixed NA poly(age, 3, raw = TRUE)2 -0.001203 0.0004413 -2.726 13222 0.006414 -0.002068 -0.0003381
fixed NA poly(age, 3, raw = TRUE)3 0.000005103 0.000004057 1.258 13011 0.2085 -0.000002848 0.00001305
fixed NA male 0.04452 0.0166 2.682 13882 0.007316 0.01199 0.07704
fixed NA sibling_count3 -0.004833 0.03316 -0.1457 11026 0.8841 -0.06983 0.06016
fixed NA sibling_count4 -0.003616 0.03464 -0.1044 10422 0.9169 -0.07151 0.06427
fixed NA sibling_count5 0.01333 0.0364 0.3662 9524 0.7142 -0.05802 0.08468
fixed NA sibling_count>5 0.0351 0.03206 1.095 11818 0.2736 -0.02774 0.09794
fixed NA birth_order_nonlinear2 -0.04456 0.02432 -1.832 12767 0.06694 -0.09222 0.003106
fixed NA birth_order_nonlinear3 -0.04247 0.02871 -1.479 12682 0.1391 -0.09874 0.01381
fixed NA birth_order_nonlinear4 -0.01607 0.03269 -0.4915 12813 0.6231 -0.08014 0.048
fixed NA birth_order_nonlinear5 -0.06266 0.03717 -1.686 12914 0.09183 -0.1355 0.01018
fixed NA birth_order_nonlinear>5 -0.03018 0.03045 -0.9914 13881 0.3215 -0.08986 0.02949
ran_pars mother_pidlink sd__(Intercept) 0.2051 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9578 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.345 0.1575 -8.541 13635 1.476e-17 -1.654 -1.037
fixed NA poly(age, 3, raw = TRUE)1 0.08008 0.01501 5.333 13463 0.00000009791 0.05065 0.1095
fixed NA poly(age, 3, raw = TRUE)2 -0.001199 0.0004413 -2.717 13210 0.006586 -0.002064 -0.0003343
fixed NA poly(age, 3, raw = TRUE)3 0.000004988 0.000004057 1.229 12991 0.219 -0.000002965 0.00001294
fixed NA male 0.0447 0.0166 2.693 13872 0.007085 0.01217 0.07723
fixed NA count_birth_order2/2 -0.1323 0.04729 -2.798 12473 0.005147 -0.225 -0.03964
fixed NA count_birth_order1/3 -0.05977 0.0442 -1.352 13880 0.1763 -0.1464 0.02685
fixed NA count_birth_order2/3 -0.05331 0.04943 -1.078 13893 0.2808 -0.1502 0.04357
fixed NA count_birth_order3/3 -0.07588 0.05538 -1.37 13904 0.1707 -0.1844 0.03267
fixed NA count_birth_order1/4 -0.03678 0.05048 -0.7286 13895 0.4663 -0.1357 0.06216
fixed NA count_birth_order2/4 -0.08135 0.0531 -1.532 13897 0.1255 -0.1854 0.02271
fixed NA count_birth_order3/4 -0.0356 0.0577 -0.6169 13903 0.5373 -0.1487 0.07749
fixed NA count_birth_order4/4 -0.1034 0.0611 -1.692 13907 0.09073 -0.2231 0.01639
fixed NA count_birth_order1/5 0.02975 0.0573 0.5192 13904 0.6037 -0.08256 0.1421
fixed NA count_birth_order2/5 -0.03593 0.06028 -0.596 13908 0.5512 -0.1541 0.08222
fixed NA count_birth_order3/5 -0.08495 0.06188 -1.373 13908 0.1698 -0.2062 0.03633
fixed NA count_birth_order4/5 -0.04652 0.06556 -0.7095 13909 0.478 -0.175 0.08198
fixed NA count_birth_order5/5 -0.1564 0.06702 -2.333 13910 0.01966 -0.2877 -0.02501
fixed NA count_birth_order1/>5 -0.04653 0.04629 -1.005 13908 0.3148 -0.1372 0.04419
fixed NA count_birth_order2/>5 -0.02981 0.04775 -0.6243 13910 0.5324 -0.1234 0.06378
fixed NA count_birth_order3/>5 -0.05692 0.04679 -1.217 13910 0.2238 -0.1486 0.03478
fixed NA count_birth_order4/>5 0.01003 0.04585 0.2187 13910 0.8269 -0.07983 0.09989
fixed NA count_birth_order5/>5 -0.03622 0.04619 -0.7841 13910 0.433 -0.1268 0.05432
fixed NA count_birth_order>5/>5 -0.02832 0.0357 -0.7933 12628 0.4276 -0.0983 0.04165
ran_pars mother_pidlink sd__(Intercept) 0.2051 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9577 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 38959 39042 -19468 38937 NA NA NA
12 38960 39051 -19468 38936 0.2064 1 0.6496
16 38963 39084 -19466 38931 5.284 4 0.2594
26 38971 39167 -19459 38919 12.56 10 0.2493

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8647 0.4405 -1.963 5915 0.04968 -1.728 -0.001376
fixed NA poly(age, 3, raw = TRUE)1 0.01416 0.04997 0.2834 5914 0.7769 -0.08377 0.1121
fixed NA poly(age, 3, raw = TRUE)2 0.001255 0.001782 0.7039 5911 0.4815 -0.002239 0.004748
fixed NA poly(age, 3, raw = TRUE)3 -0.00002195 0.00002018 -1.088 5904 0.2767 -0.0000615 0.0000176
fixed NA male 0.05224 0.02578 2.026 5900 0.04277 0.001712 0.1028
fixed NA sibling_count3 -0.02611 0.03958 -0.6597 4507 0.5095 -0.1037 0.05147
fixed NA sibling_count4 -0.04355 0.0424 -1.027 3883 0.3044 -0.1266 0.03955
fixed NA sibling_count5 -0.01096 0.04815 -0.2276 3356 0.8199 -0.1053 0.08342
fixed NA sibling_count>5 0.03937 0.04215 0.9341 3021 0.3503 -0.04324 0.122
ran_pars mother_pidlink sd__(Intercept) 0.2157 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9676 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.85 0.4404 -1.93 5914 0.05364 -1.713 0.01315
fixed NA birth_order -0.01736 0.008434 -2.058 5468 0.03961 -0.03389 -0.000829
fixed NA poly(age, 3, raw = TRUE)1 0.01482 0.04995 0.2967 5913 0.7667 -0.08309 0.1127
fixed NA poly(age, 3, raw = TRUE)2 0.001262 0.001782 0.7084 5910 0.4787 -0.00223 0.004755
fixed NA poly(age, 3, raw = TRUE)3 -0.0000227 0.00002018 -1.125 5903 0.2605 -0.00006225 0.00001684
fixed NA male 0.05295 0.02577 2.054 5899 0.03999 0.002432 0.1035
fixed NA sibling_count3 -0.01776 0.03978 -0.4464 4506 0.6553 -0.09573 0.06021
fixed NA sibling_count4 -0.02394 0.04345 -0.551 3873 0.5817 -0.1091 0.06122
fixed NA sibling_count5 0.02124 0.05063 0.4196 3407 0.6748 -0.07799 0.1205
fixed NA sibling_count>5 0.1041 0.0526 1.98 3526 0.04777 0.00106 0.2072
ran_pars mother_pidlink sd__(Intercept) 0.2163 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9672 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8407 0.4411 -1.906 5910 0.05671 -1.705 0.02385
fixed NA poly(age, 3, raw = TRUE)1 0.01289 0.04999 0.2579 5909 0.7965 -0.08509 0.1109
fixed NA poly(age, 3, raw = TRUE)2 0.001337 0.001783 0.7497 5905 0.4535 -0.002159 0.004833
fixed NA poly(age, 3, raw = TRUE)3 -0.00002361 0.00002019 -1.169 5898 0.2424 -0.00006319 0.00001597
fixed NA male 0.05276 0.02578 2.046 5895 0.04077 0.002225 0.1033
fixed NA sibling_count3 -0.01599 0.04069 -0.393 4706 0.6943 -0.09574 0.06376
fixed NA sibling_count4 -0.01708 0.04533 -0.3768 4249 0.7064 -0.1059 0.07176
fixed NA sibling_count5 0.02747 0.05349 0.5135 3911 0.6076 -0.07737 0.1323
fixed NA sibling_count>5 0.1085 0.05435 1.997 3858 0.0459 0.002011 0.215
fixed NA birth_order_nonlinear2 -0.05026 0.03374 -1.49 5060 0.1363 -0.1164 0.01586
fixed NA birth_order_nonlinear3 -0.04458 0.04152 -1.074 5325 0.283 -0.126 0.0368
fixed NA birth_order_nonlinear4 -0.08636 0.05124 -1.685 5489 0.09199 -0.1868 0.01408
fixed NA birth_order_nonlinear5 -0.08063 0.06405 -1.259 5418 0.2081 -0.2062 0.04491
fixed NA birth_order_nonlinear>5 -0.127 0.06351 -2 5876 0.04551 -0.2515 -0.002564
ran_pars mother_pidlink sd__(Intercept) 0.2164 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9674 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8614 0.4418 -1.95 5900 0.05126 -1.727 0.004539
fixed NA poly(age, 3, raw = TRUE)1 0.01798 0.05007 0.3591 5899 0.7195 -0.08016 0.1161
fixed NA poly(age, 3, raw = TRUE)2 0.001121 0.001787 0.6275 5896 0.5303 -0.002381 0.004623
fixed NA poly(age, 3, raw = TRUE)3 -0.00002076 0.00002023 -1.026 5889 0.3049 -0.00006042 0.0000189
fixed NA male 0.05421 0.02579 2.102 5884 0.03562 0.003657 0.1048
fixed NA count_birth_order2/2 -0.1018 0.06088 -1.672 5195 0.09458 -0.2211 0.01753
fixed NA count_birth_order1/3 -0.004458 0.05311 -0.08395 5894 0.9331 -0.1085 0.09963
fixed NA count_birth_order2/3 -0.1003 0.05806 -1.727 5899 0.08428 -0.2141 0.01355
fixed NA count_birth_order3/3 -0.1107 0.06495 -1.705 5900 0.08831 -0.238 0.01658
fixed NA count_birth_order1/4 -0.05653 0.06495 -0.8703 5895 0.3842 -0.1838 0.07077
fixed NA count_birth_order2/4 -0.05995 0.06727 -0.8911 5900 0.3729 -0.1918 0.0719
fixed NA count_birth_order3/4 -0.02575 0.07114 -0.362 5898 0.7174 -0.1652 0.1137
fixed NA count_birth_order4/4 -0.1802 0.07397 -2.437 5897 0.01485 -0.3252 -0.03527
fixed NA count_birth_order1/5 -0.09011 0.0883 -1.021 5900 0.3075 -0.2632 0.08294
fixed NA count_birth_order2/5 0.09637 0.0946 1.019 5898 0.3084 -0.08904 0.2818
fixed NA count_birth_order3/5 0.02785 0.08869 0.314 5896 0.7535 -0.146 0.2017
fixed NA count_birth_order4/5 -0.06482 0.08542 -0.7588 5896 0.448 -0.2322 0.1026
fixed NA count_birth_order5/5 -0.1599 0.08892 -1.798 5893 0.07225 -0.3341 0.01441
fixed NA count_birth_order1/>5 0.03187 0.08759 0.3638 5895 0.716 -0.1398 0.2035
fixed NA count_birth_order2/>5 0.01605 0.08675 0.1851 5899 0.8532 -0.154 0.1861
fixed NA count_birth_order3/>5 -0.03007 0.08697 -0.3458 5898 0.7295 -0.2005 0.1404
fixed NA count_birth_order4/>5 0.06919 0.08196 0.8442 5896 0.3986 -0.09145 0.2298
fixed NA count_birth_order5/>5 0.07304 0.07745 0.943 5895 0.3457 -0.07876 0.2249
fixed NA count_birth_order>5/>5 -0.03498 0.05771 -0.6062 5174 0.5444 -0.1481 0.07812
ran_pars mother_pidlink sd__(Intercept) 0.2171 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.967 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16715 16788 -8346 16693 NA NA NA
12 16713 16793 -8344 16689 4.241 1 0.03947
16 16719 16826 -8344 16687 1.514 4 0.8241
26 16726 16900 -8337 16674 13.11 10 0.2177

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8294 0.439 -1.889 5966 0.0589 -1.69 0.03101
fixed NA poly(age, 3, raw = TRUE)1 0.01291 0.04982 0.259 5965 0.7956 -0.08475 0.1106
fixed NA poly(age, 3, raw = TRUE)2 0.001314 0.001778 0.7389 5962 0.46 -0.002171 0.004798
fixed NA poly(age, 3, raw = TRUE)3 -0.00002253 0.00002013 -1.12 5954 0.263 -0.00006198 0.00001692
fixed NA male 0.05108 0.02567 1.99 5950 0.04666 0.0007665 0.1014
fixed NA sibling_count3 -0.06959 0.04285 -1.624 4674 0.1044 -0.1536 0.01439
fixed NA sibling_count4 -0.06697 0.04498 -1.489 4208 0.1366 -0.1551 0.0212
fixed NA sibling_count5 -0.0582 0.04789 -1.215 3688 0.2243 -0.1521 0.03566
fixed NA sibling_count>5 -0.01844 0.04201 -0.4389 3738 0.6607 -0.1008 0.06391
ran_pars mother_pidlink sd__(Intercept) 0.2172 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9672 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8205 0.4391 -1.869 5965 0.06171 -1.681 0.04006
fixed NA birth_order -0.007815 0.007334 -1.066 5112 0.2867 -0.02219 0.00656
fixed NA poly(age, 3, raw = TRUE)1 0.01293 0.04982 0.2596 5964 0.7952 -0.08472 0.1106
fixed NA poly(age, 3, raw = TRUE)2 0.001327 0.001778 0.7463 5961 0.4555 -0.002158 0.004811
fixed NA poly(age, 3, raw = TRUE)3 -0.00002298 0.00002013 -1.141 5954 0.2537 -0.00006244 0.00001648
fixed NA male 0.05132 0.02567 1.999 5949 0.04563 0.001008 0.1016
fixed NA sibling_count3 -0.06585 0.04299 -1.532 4668 0.1257 -0.1501 0.01842
fixed NA sibling_count4 -0.0585 0.04568 -1.281 4181 0.2004 -0.148 0.03103
fixed NA sibling_count5 -0.04485 0.04951 -0.9058 3674 0.3651 -0.1419 0.05219
fixed NA sibling_count>5 0.01003 0.0498 0.2014 3993 0.8404 -0.08757 0.1076
ran_pars mother_pidlink sd__(Intercept) 0.2179 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.967 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7972 0.4396 -1.813 5961 0.06981 -1.659 0.06439
fixed NA poly(age, 3, raw = TRUE)1 0.01086 0.04984 0.2178 5960 0.8276 -0.08683 0.1085
fixed NA poly(age, 3, raw = TRUE)2 0.001404 0.001779 0.7896 5956 0.4298 -0.002082 0.004891
fixed NA poly(age, 3, raw = TRUE)3 -0.00002385 0.00002015 -1.184 5948 0.2365 -0.00006333 0.00001563
fixed NA male 0.05093 0.02568 1.983 5945 0.04736 0.0006034 0.1013
fixed NA sibling_count3 -0.05132 0.04384 -1.171 4834 0.2418 -0.1372 0.0346
fixed NA sibling_count4 -0.04716 0.04742 -0.9943 4502 0.3201 -0.1401 0.04579
fixed NA sibling_count5 -0.03619 0.0521 -0.6946 4129 0.4874 -0.1383 0.06592
fixed NA sibling_count>5 0.01453 0.0515 0.2822 4358 0.7778 -0.0864 0.1155
fixed NA birth_order_nonlinear2 -0.0495 0.03432 -1.442 5196 0.1493 -0.1168 0.01776
fixed NA birth_order_nonlinear3 -0.08248 0.04134 -1.995 5451 0.04609 -0.1635 -0.00145
fixed NA birth_order_nonlinear4 -0.02223 0.04967 -0.4476 5606 0.6545 -0.1196 0.07511
fixed NA birth_order_nonlinear5 -0.04183 0.06094 -0.6863 5601 0.4925 -0.1613 0.07762
fixed NA birth_order_nonlinear>5 -0.0672 0.05659 -1.187 5850 0.2351 -0.1781 0.04372
ran_pars mother_pidlink sd__(Intercept) 0.2171 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9672 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8331 0.4403 -1.892 5951 0.05855 -1.696 0.02997
fixed NA poly(age, 3, raw = TRUE)1 0.01647 0.04991 0.3301 5950 0.7414 -0.08135 0.1143
fixed NA poly(age, 3, raw = TRUE)2 0.001182 0.001781 0.6636 5946 0.507 -0.002309 0.004674
fixed NA poly(age, 3, raw = TRUE)3 -0.00002112 0.00002018 -1.047 5938 0.2952 -0.00006067 0.00001843
fixed NA male 0.0522 0.02569 2.032 5935 0.04221 0.001847 0.1026
fixed NA count_birth_order2/2 -0.07531 0.06659 -1.131 5310 0.2581 -0.2058 0.05521
fixed NA count_birth_order1/3 -0.04684 0.05752 -0.8144 5946 0.4154 -0.1596 0.06589
fixed NA count_birth_order2/3 -0.1051 0.06241 -1.683 5950 0.09236 -0.2274 0.01726
fixed NA count_birth_order3/3 -0.1749 0.07028 -2.489 5951 0.01284 -0.3127 -0.03718
fixed NA count_birth_order1/4 -0.04383 0.06804 -0.6442 5947 0.5194 -0.1772 0.08952
fixed NA count_birth_order2/4 -0.09198 0.06936 -1.326 5950 0.1849 -0.2279 0.04397
fixed NA count_birth_order3/4 -0.08984 0.07619 -1.179 5950 0.2384 -0.2392 0.0595
fixed NA count_birth_order4/4 -0.1675 0.07856 -2.132 5949 0.03303 -0.3215 -0.01353
fixed NA count_birth_order1/5 -0.03052 0.08079 -0.3778 5950 0.7056 -0.1889 0.1278
fixed NA count_birth_order2/5 -0.122 0.08684 -1.404 5951 0.1602 -0.2922 0.04824
fixed NA count_birth_order3/5 -0.09178 0.08447 -1.087 5949 0.2773 -0.2573 0.07377
fixed NA count_birth_order4/5 0.002615 0.08758 0.02985 5945 0.9762 -0.169 0.1743
fixed NA count_birth_order5/5 -0.1843 0.08783 -2.098 5944 0.03592 -0.3564 -0.01215
fixed NA count_birth_order1/>5 -0.07646 0.07677 -0.9959 5945 0.3193 -0.2269 0.07402
fixed NA count_birth_order2/>5 -0.0221 0.08027 -0.2753 5951 0.7831 -0.1794 0.1352
fixed NA count_birth_order3/>5 -0.1136 0.07879 -1.442 5950 0.1494 -0.268 0.04081
fixed NA count_birth_order4/>5 0.01616 0.07584 0.2131 5948 0.8313 -0.1325 0.1648
fixed NA count_birth_order5/>5 0.03516 0.07798 0.4509 5942 0.6521 -0.1177 0.188
fixed NA count_birth_order>5/>5 -0.06057 0.05661 -1.07 5357 0.2847 -0.1715 0.05038
ran_pars mother_pidlink sd__(Intercept) 0.2173 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9672 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16858 16931 -8418 16836 NA NA NA
12 16859 16939 -8417 16835 1.136 1 0.2865
16 16863 16970 -8415 16831 3.922 4 0.4166
26 16873 17047 -8411 16821 9.357 10 0.4986

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7476 0.4452 -1.679 5796 0.09314 -1.62 0.1249
fixed NA poly(age, 3, raw = TRUE)1 0.003025 0.05052 0.05987 5795 0.9523 -0.096 0.102
fixed NA poly(age, 3, raw = TRUE)2 0.001617 0.001803 0.8969 5791 0.3698 -0.001917 0.005151
fixed NA poly(age, 3, raw = TRUE)3 -0.00002573 0.00002042 -1.26 5782 0.2077 -0.00006575 0.00001429
fixed NA male 0.05245 0.02602 2.016 5782 0.04386 0.001454 0.1035
fixed NA sibling_count3 -0.06345 0.03902 -1.626 4365 0.104 -0.1399 0.01303
fixed NA sibling_count4 -0.05627 0.04207 -1.338 3764 0.1811 -0.1387 0.02618
fixed NA sibling_count5 0.01114 0.04923 0.2263 3116 0.821 -0.08535 0.1076
fixed NA sibling_count>5 0.04261 0.04251 1.002 2805 0.3162 -0.0407 0.1259
ran_pars mother_pidlink sd__(Intercept) 0.215 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9666 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7362 0.4451 -1.654 5795 0.09818 -1.609 0.1362
fixed NA birth_order -0.0169 0.008689 -1.945 5418 0.05178 -0.03393 0.0001265
fixed NA poly(age, 3, raw = TRUE)1 0.003965 0.05051 0.07849 5794 0.9374 -0.09504 0.103
fixed NA poly(age, 3, raw = TRUE)2 0.001616 0.001802 0.8963 5790 0.3701 -0.001917 0.005148
fixed NA poly(age, 3, raw = TRUE)3 -0.00002637 0.00002042 -1.292 5782 0.1965 -0.00006639 0.00001365
fixed NA male 0.05286 0.02601 2.032 5781 0.0422 0.001874 0.1038
fixed NA sibling_count3 -0.0553 0.03924 -1.409 4361 0.1588 -0.1322 0.0216
fixed NA sibling_count4 -0.03742 0.04316 -0.8669 3763 0.386 -0.122 0.04718
fixed NA sibling_count5 0.04108 0.05157 0.7966 3169 0.4257 -0.05999 0.1422
fixed NA sibling_count>5 0.1052 0.05331 1.974 3411 0.04849 0.0007359 0.2097
ran_pars mother_pidlink sd__(Intercept) 0.2149 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9664 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7235 0.4458 -1.623 5791 0.1047 -1.597 0.1503
fixed NA poly(age, 3, raw = TRUE)1 0.001757 0.05055 0.03477 5789 0.9723 -0.09731 0.1008
fixed NA poly(age, 3, raw = TRUE)2 0.001695 0.001804 0.9395 5785 0.3475 -0.001841 0.00523
fixed NA poly(age, 3, raw = TRUE)3 -0.00002722 0.00002044 -1.332 5777 0.1829 -0.00006728 0.00001283
fixed NA male 0.05268 0.02603 2.024 5776 0.04299 0.001673 0.1037
fixed NA sibling_count3 -0.05402 0.04017 -1.345 4568 0.1787 -0.1328 0.0247
fixed NA sibling_count4 -0.03311 0.04509 -0.7342 4144 0.4629 -0.1215 0.05527
fixed NA sibling_count5 0.04809 0.05423 0.8869 3618 0.3752 -0.05819 0.1544
fixed NA sibling_count>5 0.1025 0.05516 1.858 3761 0.06325 -0.005624 0.2106
fixed NA birth_order_nonlinear2 -0.04874 0.03365 -1.449 4934 0.1475 -0.1147 0.01721
fixed NA birth_order_nonlinear3 -0.0439 0.04152 -1.057 5175 0.2905 -0.1253 0.03749
fixed NA birth_order_nonlinear4 -0.07397 0.05271 -1.403 5357 0.1606 -0.1773 0.02935
fixed NA birth_order_nonlinear5 -0.09912 0.06679 -1.484 5305 0.1379 -0.23 0.03179
fixed NA birth_order_nonlinear>5 -0.1016 0.06554 -1.55 5773 0.1211 -0.2301 0.02684
ran_pars mother_pidlink sd__(Intercept) 0.2148 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9667 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7227 0.4465 -1.619 5781 0.1056 -1.598 0.1524
fixed NA poly(age, 3, raw = TRUE)1 0.004249 0.05062 0.08394 5780 0.9331 -0.09497 0.1035
fixed NA poly(age, 3, raw = TRUE)2 0.001573 0.001807 0.8707 5775 0.384 -0.001968 0.005114
fixed NA poly(age, 3, raw = TRUE)3 -0.00002548 0.00002047 -1.244 5766 0.2134 -0.0000656 0.00001465
fixed NA male 0.0537 0.02603 2.063 5765 0.03913 0.00269 0.1047
fixed NA count_birth_order2/2 -0.09551 0.05926 -1.612 5042 0.1071 -0.2117 0.02064
fixed NA count_birth_order1/3 -0.0317 0.05239 -0.6052 5774 0.5451 -0.1344 0.07098
fixed NA count_birth_order2/3 -0.1419 0.05797 -2.447 5780 0.01442 -0.2555 -0.02825
fixed NA count_birth_order3/3 -0.1565 0.06373 -2.456 5780 0.01408 -0.2814 -0.03161
fixed NA count_birth_order1/4 -0.1047 0.0652 -1.606 5777 0.1083 -0.2325 0.02307
fixed NA count_birth_order2/4 -0.03028 0.0671 -0.4513 5781 0.6518 -0.1618 0.1012
fixed NA count_birth_order3/4 -0.01813 0.07034 -0.2577 5778 0.7966 -0.156 0.1197
fixed NA count_birth_order4/4 -0.2182 0.07436 -2.935 5777 0.003354 -0.3639 -0.07247
fixed NA count_birth_order1/5 -0.08435 0.08798 -0.9588 5780 0.3377 -0.2568 0.08809
fixed NA count_birth_order2/5 0.0693 0.09733 0.712 5779 0.4765 -0.1215 0.2601
fixed NA count_birth_order3/5 0.05283 0.09288 0.5688 5777 0.5695 -0.1292 0.2349
fixed NA count_birth_order4/5 -0.0298 0.08948 -0.333 5777 0.7391 -0.2052 0.1456
fixed NA count_birth_order5/5 -0.08705 0.09509 -0.9154 5774 0.36 -0.2734 0.09932
fixed NA count_birth_order1/>5 0.07337 0.08958 0.8191 5779 0.4128 -0.1022 0.2489
fixed NA count_birth_order2/>5 -0.01039 0.08886 -0.1169 5780 0.9069 -0.1845 0.1638
fixed NA count_birth_order3/>5 -0.04537 0.08811 -0.515 5778 0.6066 -0.2181 0.1273
fixed NA count_birth_order4/>5 0.1355 0.08621 1.571 5775 0.1161 -0.0335 0.3044
fixed NA count_birth_order5/>5 0.0005431 0.07922 0.006856 5775 0.9945 -0.1547 0.1558
fixed NA count_birth_order>5/>5 -0.01412 0.05865 -0.2408 4974 0.8097 -0.1291 0.1008
ran_pars mother_pidlink sd__(Intercept) 0.2155 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9659 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16366 16440 -8172 16344 NA NA NA
12 16364 16444 -8170 16340 3.79 1 0.05156
16 16372 16478 -8170 16340 0.7968 4 0.9389
26 16375 16548 -8161 16323 16.83 10 0.07811

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Agreeableness

birthorder <- birthorder %>% mutate(outcome = big5_agree)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5625 0.1596 -3.524 13676 0.0004259 -0.8753 -0.2497
fixed NA poly(age, 3, raw = TRUE)1 0.0273 0.01529 1.786 13553 0.07411 -0.002658 0.05726
fixed NA poly(age, 3, raw = TRUE)2 -0.0002583 0.0004491 -0.5752 13371 0.5652 -0.001139 0.0006219
fixed NA poly(age, 3, raw = TRUE)3 -0.0000008022 0.000004131 -0.1942 13199 0.846 -0.000008898 0.000007294
fixed NA male 0.06076 0.0169 3.596 13854 0.0003241 0.02764 0.09387
fixed NA sibling_count3 -0.02089 0.03345 -0.6245 10670 0.5323 -0.08646 0.04467
fixed NA sibling_count4 0.03056 0.03436 0.8896 9679 0.3737 -0.03677 0.0979
fixed NA sibling_count5 0.007767 0.03558 0.2183 8553 0.8272 -0.06196 0.0775
fixed NA sibling_count>5 0.005771 0.02805 0.2058 9766 0.837 -0.0492 0.06074
ran_pars mother_pidlink sd__(Intercept) 0.2511 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9667 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5602 0.1596 -3.509 13678 0.0004505 -0.873 -0.2473
fixed NA birth_order 0.004807 0.003507 1.371 11206 0.1704 -0.002065 0.01168
fixed NA poly(age, 3, raw = TRUE)1 0.02588 0.01532 1.689 13536 0.09117 -0.004146 0.05591
fixed NA poly(age, 3, raw = TRUE)2 -0.0002084 0.0004506 -0.4624 13310 0.6438 -0.001091 0.0006747
fixed NA poly(age, 3, raw = TRUE)3 -0.000001256 0.000004144 -0.303 13116 0.7619 -0.000009377 0.000006866
fixed NA male 0.06062 0.0169 3.588 13853 0.0003345 0.02751 0.09373
fixed NA sibling_count3 -0.0221 0.03346 -0.6604 10683 0.509 -0.08768 0.04349
fixed NA sibling_count4 0.02712 0.03445 0.7873 9736 0.4311 -0.0404 0.09463
fixed NA sibling_count5 0.001865 0.03584 0.05204 8652 0.9585 -0.06837 0.0721
fixed NA sibling_count>5 -0.01264 0.03109 -0.4065 10700 0.6844 -0.07358 0.0483
ran_pars mother_pidlink sd__(Intercept) 0.251 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9667 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5594 0.1601 -3.495 13681 0.0004758 -0.8731 -0.2457
fixed NA poly(age, 3, raw = TRUE)1 0.02613 0.01533 1.705 13547 0.0882 -0.003906 0.05617
fixed NA poly(age, 3, raw = TRUE)2 -0.0002155 0.0004507 -0.4782 13321 0.6325 -0.001099 0.0006679
fixed NA poly(age, 3, raw = TRUE)3 -0.000001198 0.000004146 -0.2889 13117 0.7727 -0.000009323 0.000006927
fixed NA male 0.0607 0.0169 3.592 13849 0.0003293 0.02758 0.09382
fixed NA sibling_count3 -0.01916 0.03398 -0.5638 11024 0.5729 -0.08576 0.04744
fixed NA sibling_count4 0.02892 0.03552 0.814 10472 0.4156 -0.0407 0.09853
fixed NA sibling_count5 0.007183 0.03737 0.1922 9652 0.8476 -0.06606 0.08043
fixed NA sibling_count>5 -0.01117 0.03282 -0.3404 11853 0.7335 -0.0755 0.05315
fixed NA birth_order_nonlinear2 0.008944 0.0247 0.3622 12790 0.7172 -0.03946 0.05735
fixed NA birth_order_nonlinear3 -0.002557 0.02915 -0.08772 12675 0.9301 -0.0597 0.05458
fixed NA birth_order_nonlinear4 0.02067 0.0332 0.6226 12782 0.5336 -0.0444 0.08574
fixed NA birth_order_nonlinear5 -0.001727 0.03775 -0.04573 12862 0.9635 -0.07572 0.07227
fixed NA birth_order_nonlinear>5 0.04206 0.03104 1.355 13911 0.1753 -0.01877 0.1029
ran_pars mother_pidlink sd__(Intercept) 0.251 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9668 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5441 0.1607 -3.384 13685 0.0007151 -0.8591 -0.229
fixed NA poly(age, 3, raw = TRUE)1 0.0261 0.01533 1.703 13541 0.08864 -0.003943 0.05615
fixed NA poly(age, 3, raw = TRUE)2 -0.0002053 0.0004508 -0.4555 13310 0.6487 -0.001089 0.0006782
fixed NA poly(age, 3, raw = TRUE)3 -0.000001373 0.000004146 -0.331 13098 0.7406 -0.0000095 0.000006754
fixed NA male 0.06108 0.0169 3.615 13836 0.0003019 0.02796 0.0942
fixed NA count_birth_order2/2 -0.03887 0.048 -0.8099 12577 0.418 -0.133 0.0552
fixed NA count_birth_order1/3 -0.02833 0.04506 -0.6288 13856 0.5295 -0.1167 0.05999
fixed NA count_birth_order2/3 0.003943 0.05039 0.07825 13880 0.9376 -0.09482 0.1027
fixed NA count_birth_order3/3 -0.1023 0.05645 -1.812 13899 0.07 -0.2129 0.008348
fixed NA count_birth_order1/4 0.0002992 0.05146 0.005815 13883 0.9954 -0.1006 0.1012
fixed NA count_birth_order2/4 0.0164 0.05412 0.3031 13889 0.7618 -0.08967 0.1225
fixed NA count_birth_order3/4 -0.02745 0.05881 -0.4668 13900 0.6406 -0.1427 0.08781
fixed NA count_birth_order4/4 0.09601 0.06227 1.542 13907 0.1231 -0.02603 0.218
fixed NA count_birth_order1/5 0.03871 0.0584 0.6629 13900 0.5074 -0.07574 0.1532
fixed NA count_birth_order2/5 -0.03562 0.06143 -0.5797 13907 0.5621 -0.156 0.08479
fixed NA count_birth_order3/5 -0.03819 0.06306 -0.6057 13908 0.5448 -0.1618 0.0854
fixed NA count_birth_order4/5 -0.01414 0.0668 -0.2117 13910 0.8323 -0.1451 0.1168
fixed NA count_birth_order5/5 0.01126 0.06829 0.1649 13910 0.869 -0.1226 0.1451
fixed NA count_birth_order1/>5 -0.08303 0.04717 -1.76 13908 0.07837 -0.1755 0.009415
fixed NA count_birth_order2/>5 -0.001421 0.04866 -0.02921 13910 0.9767 -0.09679 0.09394
fixed NA count_birth_order3/>5 0.03321 0.04767 0.6967 13910 0.486 -0.06022 0.1266
fixed NA count_birth_order4/>5 -0.02795 0.04671 -0.5984 13910 0.5496 -0.1195 0.06361
fixed NA count_birth_order5/>5 -0.03953 0.04706 -0.8398 13909 0.401 -0.1318 0.05272
fixed NA count_birth_order>5/>5 0.0126 0.03651 0.3452 12680 0.73 -0.05896 0.08416
ran_pars mother_pidlink sd__(Intercept) 0.2528 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9662 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 39479 39562 -19728 39457 NA NA NA
12 39479 39569 -19727 39455 1.881 1 0.1702
16 39486 39607 -19727 39454 0.9485 4 0.9175
26 39492 39688 -19720 39440 13.71 10 0.1865

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.645 0.4388 -1.47 5911 0.1416 -1.505 0.215
fixed NA poly(age, 3, raw = TRUE)1 0.03354 0.04978 0.6737 5914 0.5005 -0.06403 0.1311
fixed NA poly(age, 3, raw = TRUE)2 -0.0003367 0.001776 -0.1896 5915 0.8496 -0.003818 0.003144
fixed NA poly(age, 3, raw = TRUE)3 -0.0000005582 0.00002011 -0.02776 5914 0.9779 -0.00003997 0.00003886
fixed NA male 0.05795 0.02567 2.258 5886 0.024 0.007642 0.1083
fixed NA sibling_count3 -0.04282 0.03968 -1.079 4538 0.2805 -0.1206 0.03495
fixed NA sibling_count4 -0.05145 0.04258 -1.208 3962 0.227 -0.1349 0.032
fixed NA sibling_count5 0.007037 0.04843 0.1453 3482 0.8845 -0.08788 0.102
fixed NA sibling_count>5 -0.05468 0.04243 -1.288 3192 0.1977 -0.1378 0.02849
ran_pars mother_pidlink sd__(Intercept) 0.2632 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9527 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.6472 0.4389 -1.475 5910 0.1404 -1.507 0.213
fixed NA birth_order 0.002615 0.00843 0.3102 5637 0.7564 -0.01391 0.01914
fixed NA poly(age, 3, raw = TRUE)1 0.03343 0.04979 0.6715 5913 0.5019 -0.06415 0.131
fixed NA poly(age, 3, raw = TRUE)2 -0.0003375 0.001776 -0.19 5914 0.8493 -0.003819 0.003144
fixed NA poly(age, 3, raw = TRUE)3 -0.0000004477 0.00002011 -0.02226 5913 0.9822 -0.00003987 0.00003898
fixed NA male 0.05784 0.02567 2.253 5885 0.02429 0.007523 0.1082
fixed NA sibling_count3 -0.04408 0.03989 -1.105 4540 0.2692 -0.1223 0.0341
fixed NA sibling_count4 -0.05442 0.04364 -1.247 3959 0.2125 -0.14 0.03112
fixed NA sibling_count5 0.002162 0.05092 0.04246 3544 0.9661 -0.09764 0.102
fixed NA sibling_count>5 -0.06446 0.05288 -1.219 3698 0.2229 -0.1681 0.03918
ran_pars mother_pidlink sd__(Intercept) 0.2632 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9528 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.6237 0.4395 -1.419 5907 0.1559 -1.485 0.2378
fixed NA poly(age, 3, raw = TRUE)1 0.03241 0.04982 0.6507 5909 0.5153 -0.06522 0.1301
fixed NA poly(age, 3, raw = TRUE)2 -0.0002935 0.001777 -0.1651 5910 0.8689 -0.003777 0.00319
fixed NA poly(age, 3, raw = TRUE)3 -0.000001054 0.00002013 -0.05235 5909 0.9583 -0.00004051 0.0000384
fixed NA male 0.05752 0.02568 2.24 5880 0.02512 0.007194 0.1078
fixed NA sibling_count3 -0.03331 0.04077 -0.8171 4729 0.4139 -0.1132 0.04659
fixed NA sibling_count4 -0.05023 0.04547 -1.105 4313 0.2693 -0.1394 0.03889
fixed NA sibling_count5 -0.003593 0.05371 -0.06689 4020 0.9467 -0.1089 0.1017
fixed NA sibling_count>5 -0.05582 0.05457 -1.023 4005 0.3064 -0.1628 0.05114
fixed NA birth_order_nonlinear2 -0.03669 0.03347 -1.096 5072 0.2731 -0.1023 0.02892
fixed NA birth_order_nonlinear3 -0.04412 0.04123 -1.07 5315 0.2846 -0.1249 0.03668
fixed NA birth_order_nonlinear4 0.02951 0.05091 0.5796 5468 0.5622 -0.07027 0.1293
fixed NA birth_order_nonlinear5 0.03323 0.06362 0.5224 5383 0.6014 -0.09146 0.1579
fixed NA birth_order_nonlinear>5 -0.03071 0.06333 -0.485 5903 0.6277 -0.1548 0.0934
ran_pars mother_pidlink sd__(Intercept) 0.263 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9529 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.6322 0.4405 -1.435 5898 0.1513 -1.496 0.2312
fixed NA poly(age, 3, raw = TRUE)1 0.03344 0.04993 0.6699 5899 0.503 -0.06441 0.1313
fixed NA poly(age, 3, raw = TRUE)2 -0.0003295 0.001782 -0.1849 5900 0.8533 -0.003822 0.003163
fixed NA poly(age, 3, raw = TRUE)3 -0.0000006666 0.00002018 -0.03303 5899 0.9737 -0.00004022 0.00003889
fixed NA male 0.05848 0.0257 2.276 5870 0.02291 0.008111 0.1089
fixed NA count_birth_order2/2 -0.03959 0.06047 -0.6547 5235 0.5127 -0.1581 0.07893
fixed NA count_birth_order1/3 -0.02909 0.05298 -0.5491 5890 0.5829 -0.1329 0.07474
fixed NA count_birth_order2/3 -0.05869 0.05791 -1.014 5898 0.3108 -0.1722 0.0548
fixed NA count_birth_order3/3 -0.1059 0.06475 -1.636 5900 0.102 -0.2328 0.021
fixed NA count_birth_order1/4 -0.06212 0.06478 -0.9589 5893 0.3377 -0.1891 0.06485
fixed NA count_birth_order2/4 -0.1076 0.06708 -1.603 5900 0.1089 -0.239 0.02392
fixed NA count_birth_order3/4 -0.0601 0.07093 -0.8474 5898 0.3968 -0.1991 0.07891
fixed NA count_birth_order4/4 -0.0189 0.07374 -0.2563 5897 0.7978 -0.1634 0.1256
fixed NA count_birth_order1/5 0.04298 0.08804 0.4882 5900 0.6255 -0.1296 0.2155
fixed NA count_birth_order2/5 -0.101 0.09431 -1.071 5895 0.2844 -0.2858 0.08387
fixed NA count_birth_order3/5 -0.02089 0.08841 -0.2363 5893 0.8132 -0.1942 0.1524
fixed NA count_birth_order4/5 -0.05274 0.08515 -0.6193 5895 0.5357 -0.2196 0.1142
fixed NA count_birth_order5/5 0.08936 0.08862 1.008 5890 0.3134 -0.08434 0.2631
fixed NA count_birth_order1/>5 -0.1027 0.08735 -1.176 5900 0.2398 -0.2739 0.06853
fixed NA count_birth_order2/>5 -0.0403 0.08651 -0.4659 5900 0.6413 -0.2099 0.1292
fixed NA count_birth_order3/>5 -0.1274 0.08669 -1.47 5892 0.1417 -0.2973 0.04252
fixed NA count_birth_order4/>5 0.03782 0.08169 0.463 5889 0.6434 -0.1223 0.1979
fixed NA count_birth_order5/>5 -0.0659 0.0772 -0.8536 5888 0.3934 -0.2172 0.08541
fixed NA count_birth_order>5/>5 -0.08752 0.05776 -1.515 5299 0.1298 -0.2007 0.02568
ran_pars mother_pidlink sd__(Intercept) 0.2633 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9531 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16672 16745 -8325 16650 NA NA NA
12 16673 16754 -8325 16649 0.09659 1 0.756
16 16677 16784 -8323 16645 3.955 4 0.4121
26 16692 16866 -8320 16640 5.719 10 0.8383

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.6188 0.4369 -1.416 5962 0.1568 -1.475 0.2376
fixed NA poly(age, 3, raw = TRUE)1 0.03119 0.04959 0.629 5965 0.5294 -0.06601 0.1284
fixed NA poly(age, 3, raw = TRUE)2 -0.0002451 0.00177 -0.1385 5966 0.8899 -0.003714 0.003224
fixed NA poly(age, 3, raw = TRUE)3 -0.000001585 0.00002004 -0.07908 5965 0.937 -0.00004086 0.00003769
fixed NA male 0.05768 0.02554 2.259 5937 0.02392 0.007634 0.1077
fixed NA sibling_count3 -0.05156 0.04288 -1.202 4705 0.2292 -0.1356 0.03248
fixed NA sibling_count4 -0.02386 0.04507 -0.5294 4273 0.5965 -0.1122 0.06447
fixed NA sibling_count5 -0.03461 0.04805 -0.7203 3794 0.4714 -0.1288 0.05956
fixed NA sibling_count>5 -0.0736 0.04215 -1.746 3867 0.08084 -0.1562 0.009005
ran_pars mother_pidlink sd__(Intercept) 0.2616 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.952 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.6268 0.437 -1.434 5961 0.1515 -1.483 0.2296
fixed NA birth_order 0.007124 0.007328 0.9722 5363 0.331 -0.007238 0.02149
fixed NA poly(age, 3, raw = TRUE)1 0.03115 0.04959 0.6282 5964 0.5299 -0.06605 0.1283
fixed NA poly(age, 3, raw = TRUE)2 -0.0002563 0.00177 -0.1448 5965 0.8849 -0.003725 0.003212
fixed NA poly(age, 3, raw = TRUE)3 -0.000001183 0.00002005 -0.05902 5964 0.9529 -0.00004047 0.0000381
fixed NA male 0.05745 0.02554 2.249 5936 0.02452 0.007393 0.1075
fixed NA sibling_count3 -0.05498 0.04302 -1.278 4700 0.2013 -0.1393 0.02934
fixed NA sibling_count4 -0.03161 0.04577 -0.6907 4250 0.4898 -0.1213 0.05809
fixed NA sibling_count5 -0.04685 0.04967 -0.9433 3789 0.3456 -0.1442 0.0505
fixed NA sibling_count>5 -0.0996 0.04991 -1.995 4129 0.04606 -0.1974 -0.001771
ran_pars mother_pidlink sd__(Intercept) 0.2614 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9521 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.6006 0.4376 -1.373 5959 0.1699 -1.458 0.2571
fixed NA poly(age, 3, raw = TRUE)1 0.03018 0.04962 0.6083 5960 0.543 -0.06707 0.1274
fixed NA poly(age, 3, raw = TRUE)2 -0.0002201 0.001771 -0.1243 5961 0.9011 -0.003691 0.003251
fixed NA poly(age, 3, raw = TRUE)3 -0.000001571 0.00002006 -0.07831 5960 0.9376 -0.00004089 0.00003775
fixed NA male 0.05734 0.02555 2.244 5932 0.02485 0.007266 0.1074
fixed NA sibling_count3 -0.04586 0.04386 -1.046 4857 0.2958 -0.1318 0.0401
fixed NA sibling_count4 -0.0244 0.04748 -0.5138 4553 0.6074 -0.1175 0.06867
fixed NA sibling_count5 -0.04551 0.05221 -0.8717 4217 0.3834 -0.1478 0.05682
fixed NA sibling_count>5 -0.1009 0.05158 -1.957 4460 0.05039 -0.202 0.0001439
fixed NA birth_order_nonlinear2 -0.02657 0.03404 -0.7807 5209 0.435 -0.09328 0.04014
fixed NA birth_order_nonlinear3 -0.02837 0.04103 -0.6913 5442 0.4894 -0.1088 0.05206
fixed NA birth_order_nonlinear4 0.01991 0.04932 0.4036 5589 0.6865 -0.07676 0.1166
fixed NA birth_order_nonlinear5 0.04047 0.06051 0.6688 5572 0.5036 -0.07813 0.1591
fixed NA birth_order_nonlinear>5 0.04104 0.05641 0.7276 5905 0.4669 -0.06952 0.1516
ran_pars mother_pidlink sd__(Intercept) 0.2608 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9524 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.6018 0.4385 -1.372 5949 0.1701 -1.461 0.2578
fixed NA poly(age, 3, raw = TRUE)1 0.03204 0.04971 0.6445 5950 0.5193 -0.06539 0.1295
fixed NA poly(age, 3, raw = TRUE)2 -0.0002896 0.001775 -0.1632 5951 0.8704 -0.003768 0.003189
fixed NA poly(age, 3, raw = TRUE)3 -0.0000007273 0.0000201 -0.03618 5949 0.9711 -0.00004013 0.00003868
fixed NA male 0.05762 0.02557 2.253 5922 0.0243 0.007493 0.1077
fixed NA count_birth_order2/2 -0.07001 0.0661 -1.059 5348 0.2896 -0.1996 0.05955
fixed NA count_birth_order1/3 -0.05588 0.05731 -0.9752 5941 0.3295 -0.1682 0.05643
fixed NA count_birth_order2/3 -0.06772 0.06217 -1.089 5949 0.2761 -0.1896 0.05414
fixed NA count_birth_order3/3 -0.127 0.07 -1.814 5951 0.06968 -0.2642 0.0102
fixed NA count_birth_order1/4 -0.05227 0.06778 -0.7711 5945 0.4407 -0.1851 0.08058
fixed NA count_birth_order2/4 -0.04976 0.06909 -0.7201 5950 0.4715 -0.1852 0.08567
fixed NA count_birth_order3/4 -0.07543 0.07588 -0.9941 5949 0.3202 -0.2241 0.07329
fixed NA count_birth_order4/4 -0.01413 0.07823 -0.1806 5949 0.8567 -0.1675 0.1392
fixed NA count_birth_order1/5 -0.03582 0.08047 -0.4451 5950 0.6562 -0.1935 0.1219
fixed NA count_birth_order2/5 -0.1593 0.08648 -1.842 5949 0.06554 -0.3288 0.01021
fixed NA count_birth_order3/5 -0.03115 0.08411 -0.3704 5948 0.7111 -0.196 0.1337
fixed NA count_birth_order4/5 -0.06292 0.0872 -0.7215 5943 0.4706 -0.2338 0.108
fixed NA count_birth_order5/5 -0.0179 0.08745 -0.2047 5941 0.8378 -0.1893 0.1535
fixed NA count_birth_order1/>5 -0.1703 0.07649 -2.227 5948 0.02598 -0.3203 -0.02043
fixed NA count_birth_order2/>5 -0.1037 0.07995 -1.297 5951 0.1948 -0.2604 0.05303
fixed NA count_birth_order3/>5 -0.1335 0.07845 -1.701 5947 0.08891 -0.2873 0.02028
fixed NA count_birth_order4/>5 -0.08556 0.07552 -1.133 5945 0.2573 -0.2336 0.06246
fixed NA count_birth_order5/>5 -0.07678 0.07763 -0.989 5935 0.3227 -0.2289 0.07538
fixed NA count_birth_order>5/>5 -0.07471 0.05656 -1.321 5447 0.1866 -0.1856 0.03614
ran_pars mother_pidlink sd__(Intercept) 0.2602 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9531 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16802 16876 -8390 16780 NA NA NA
12 16803 16884 -8390 16779 0.9475 1 0.3304
16 16810 16917 -8389 16778 1.889 4 0.7562
26 16825 17000 -8387 16773 4.132 10 0.9412

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5969 0.4431 -1.347 5793 0.178 -1.465 0.2716
fixed NA poly(age, 3, raw = TRUE)1 0.02716 0.0503 0.5399 5795 0.5893 -0.07142 0.1257
fixed NA poly(age, 3, raw = TRUE)2 -0.00008155 0.001795 -0.04543 5796 0.9638 -0.0036 0.003437
fixed NA poly(age, 3, raw = TRUE)3 -0.000003671 0.00002033 -0.1805 5794 0.8567 -0.00004353 0.00003618
fixed NA male 0.0572 0.02589 2.21 5769 0.02718 0.00646 0.1079
fixed NA sibling_count3 -0.04753 0.03907 -1.217 4416 0.2238 -0.1241 0.02904
fixed NA sibling_count4 -0.06009 0.04218 -1.425 3862 0.1544 -0.1428 0.02258
fixed NA sibling_count5 0.04759 0.04945 0.9624 3265 0.3359 -0.04933 0.1445
fixed NA sibling_count>5 -0.0633 0.04274 -1.481 2989 0.1387 -0.1471 0.02047
ran_pars mother_pidlink sd__(Intercept) 0.2586 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9519 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5982 0.4432 -1.35 5792 0.1771 -1.467 0.2704
fixed NA birth_order 0.001925 0.008673 0.222 5563 0.8243 -0.01507 0.01892
fixed NA poly(age, 3, raw = TRUE)1 0.02705 0.0503 0.5377 5794 0.5908 -0.07154 0.1256
fixed NA poly(age, 3, raw = TRUE)2 -0.00008128 0.001795 -0.04528 5795 0.9639 -0.0036 0.003437
fixed NA poly(age, 3, raw = TRUE)3 -0.000003598 0.00002034 -0.1769 5793 0.8596 -0.00004346 0.00003627
fixed NA male 0.05715 0.02589 2.207 5768 0.02732 0.006407 0.1079
fixed NA sibling_count3 -0.04846 0.03929 -1.233 4416 0.2176 -0.1255 0.02856
fixed NA sibling_count4 -0.06225 0.04329 -1.438 3871 0.1505 -0.1471 0.0226
fixed NA sibling_count5 0.04417 0.05181 0.8525 3330 0.394 -0.05738 0.1457
fixed NA sibling_count>5 -0.07045 0.05352 -1.316 3599 0.1881 -0.1753 0.03444
ran_pars mother_pidlink sd__(Intercept) 0.2587 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9519 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5775 0.4438 -1.301 5789 0.1932 -1.447 0.2924
fixed NA poly(age, 3, raw = TRUE)1 0.02592 0.05033 0.515 5791 0.6066 -0.07272 0.1246
fixed NA poly(age, 3, raw = TRUE)2 -0.00003914 0.001796 -0.02179 5791 0.9826 -0.00356 0.003481
fixed NA poly(age, 3, raw = TRUE)3 -0.000004064 0.00002035 -0.1997 5789 0.8417 -0.00004396 0.00003583
fixed NA male 0.0566 0.0259 2.186 5763 0.02888 0.005845 0.1074
fixed NA sibling_count3 -0.03684 0.0402 -0.9166 4608 0.3594 -0.1156 0.04194
fixed NA sibling_count4 -0.05666 0.04517 -1.254 4225 0.2098 -0.1452 0.03188
fixed NA sibling_count5 0.04475 0.0544 0.8225 3754 0.4108 -0.06188 0.1514
fixed NA sibling_count>5 -0.06844 0.05532 -1.237 3922 0.2161 -0.1769 0.03998
fixed NA birth_order_nonlinear2 -0.02562 0.03336 -0.768 4955 0.4425 -0.09101 0.03976
fixed NA birth_order_nonlinear3 -0.04947 0.0412 -1.201 5175 0.2299 -0.1302 0.03128
fixed NA birth_order_nonlinear4 0.0286 0.05233 0.5465 5341 0.5847 -0.07397 0.1312
fixed NA birth_order_nonlinear5 0.007749 0.06629 0.1169 5277 0.9069 -0.1222 0.1377
fixed NA birth_order_nonlinear>5 -0.00116 0.06527 -0.01777 5789 0.9858 -0.1291 0.1268
ran_pars mother_pidlink sd__(Intercept) 0.2588 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.952 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5521 0.4449 -1.241 5780 0.2147 -1.424 0.3198
fixed NA poly(age, 3, raw = TRUE)1 0.02312 0.05045 0.4584 5781 0.6467 -0.07575 0.122
fixed NA poly(age, 3, raw = TRUE)2 0.00006625 0.001801 0.03679 5781 0.9707 -0.003463 0.003596
fixed NA poly(age, 3, raw = TRUE)3 -0.000005314 0.00002041 -0.2604 5779 0.7945 -0.00004531 0.00003468
fixed NA male 0.05695 0.02592 2.197 5752 0.02805 0.006146 0.1078
fixed NA count_birth_order2/2 -0.03262 0.05883 -0.5544 5086 0.5793 -0.1479 0.08269
fixed NA count_birth_order1/3 -0.03163 0.05223 -0.6057 5770 0.5448 -0.134 0.07073
fixed NA count_birth_order2/3 -0.05113 0.05778 -0.885 5780 0.3762 -0.1644 0.06211
fixed NA count_birth_order3/3 -0.1218 0.0635 -1.918 5780 0.05516 -0.2462 0.002663
fixed NA count_birth_order1/4 -0.07897 0.06499 -1.215 5777 0.2244 -0.2063 0.0484
fixed NA count_birth_order2/4 -0.1058 0.06687 -1.583 5781 0.1135 -0.2369 0.02521
fixed NA count_birth_order3/4 -0.07093 0.07008 -1.012 5777 0.3115 -0.2083 0.06642
fixed NA count_birth_order4/4 -0.01687 0.07408 -0.2277 5775 0.8199 -0.1621 0.1283
fixed NA count_birth_order1/5 0.05054 0.08768 0.5764 5781 0.5644 -0.1213 0.2224
fixed NA count_birth_order2/5 -0.01504 0.09697 -0.1551 5776 0.8767 -0.2051 0.175
fixed NA count_birth_order3/5 -0.0003237 0.09252 -0.003499 5773 0.9972 -0.1817 0.181
fixed NA count_birth_order4/5 -0.02 0.08914 -0.2244 5775 0.8225 -0.1947 0.1547
fixed NA count_birth_order5/5 0.1681 0.09472 1.774 5771 0.07608 -0.0176 0.3537
fixed NA count_birth_order1/>5 -0.0804 0.08927 -0.9006 5781 0.3679 -0.2554 0.09458
fixed NA count_birth_order2/>5 -0.05915 0.08855 -0.668 5780 0.5042 -0.2327 0.1144
fixed NA count_birth_order3/>5 -0.1176 0.08777 -1.34 5772 0.1802 -0.2897 0.0544
fixed NA count_birth_order4/>5 0.02036 0.08587 0.2372 5765 0.8125 -0.1479 0.1887
fixed NA count_birth_order5/>5 -0.1374 0.07891 -1.741 5767 0.08173 -0.2921 0.01728
fixed NA count_birth_order>5/>5 -0.07222 0.05867 -1.231 5114 0.2184 -0.1872 0.04277
ran_pars mother_pidlink sd__(Intercept) 0.2592 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9522 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16314 16387 -8146 16292 NA NA NA
12 16316 16396 -8146 16292 0.0492 1 0.8245
16 16321 16428 -8144 16289 2.826 4 0.5874
26 16334 16508 -8141 16282 6.65 10 0.758

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Openness

birthorder <- birthorder %>% mutate(outcome = big5_open)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4167 0.1589 2.623 13709 0.008727 0.1053 0.728
fixed NA poly(age, 3, raw = TRUE)1 -0.03942 0.01522 -2.59 13601 0.009601 -0.06925 -0.009592
fixed NA poly(age, 3, raw = TRUE)2 0.001142 0.0004473 2.552 13428 0.01072 0.0002649 0.002018
fixed NA poly(age, 3, raw = TRUE)3 -0.00001113 0.000004115 -2.705 13257 0.006832 -0.0000192 -0.000003067
fixed NA male 0.1705 0.01678 10.16 13815 3.517e-24 0.1377 0.2034
fixed NA sibling_count3 -0.0164 0.03344 -0.4905 10579 0.6238 -0.08194 0.04913
fixed NA sibling_count4 -0.04541 0.03438 -1.321 9628 0.1866 -0.1128 0.02197
fixed NA sibling_count5 -0.004679 0.03564 -0.1313 8559 0.8956 -0.07454 0.06518
fixed NA sibling_count>5 -0.07108 0.02806 -2.533 9722 0.01132 -0.1261 -0.01608
ran_pars mother_pidlink sd__(Intercept) 0.2818 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9529 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4136 0.1588 2.604 13710 0.009231 0.1023 0.7249
fixed NA birth_order -0.006737 0.003501 -1.924 11701 0.05434 -0.0136 0.0001249
fixed NA poly(age, 3, raw = TRUE)1 -0.03742 0.01525 -2.453 13584 0.01416 -0.06731 -0.007525
fixed NA poly(age, 3, raw = TRUE)2 0.001071 0.0004488 2.386 13368 0.01707 0.000191 0.00195
fixed NA poly(age, 3, raw = TRUE)3 -0.00001049 0.000004129 -2.54 13175 0.0111 -0.00001858 -0.000002394
fixed NA male 0.1707 0.01678 10.18 13814 3.116e-24 0.1378 0.2036
fixed NA sibling_count3 -0.01476 0.03344 -0.4413 10591 0.659 -0.0803 0.05079
fixed NA sibling_count4 -0.04063 0.03446 -1.179 9685 0.2384 -0.1082 0.02691
fixed NA sibling_count5 0.003553 0.03589 0.099 8660 0.9211 -0.06679 0.0739
fixed NA sibling_count>5 -0.04537 0.03107 -1.46 10694 0.1443 -0.1063 0.01553
ran_pars mother_pidlink sd__(Intercept) 0.2814 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9529 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4067 0.1593 2.554 13713 0.01067 0.09454 0.7189
fixed NA poly(age, 3, raw = TRUE)1 -0.03765 0.01526 -2.467 13594 0.01362 -0.06755 -0.007742
fixed NA poly(age, 3, raw = TRUE)2 0.001092 0.0004489 2.432 13379 0.01501 0.0002121 0.001972
fixed NA poly(age, 3, raw = TRUE)3 -0.00001079 0.00000413 -2.613 13175 0.008993 -0.00001889 -0.000002696
fixed NA male 0.1708 0.01678 10.18 13810 3.101e-24 0.1379 0.2036
fixed NA sibling_count3 -0.004799 0.03395 -0.1414 10928 0.8876 -0.07133 0.06173
fixed NA sibling_count4 -0.02479 0.0355 -0.6983 10404 0.485 -0.09438 0.04479
fixed NA sibling_count5 0.01456 0.03739 0.3894 9631 0.697 -0.05872 0.08783
fixed NA sibling_count>5 -0.04095 0.03276 -1.25 11805 0.2113 -0.1051 0.02325
fixed NA birth_order_nonlinear2 -0.01379 0.02447 -0.5636 12763 0.5731 -0.06176 0.03417
fixed NA birth_order_nonlinear3 -0.0592 0.02888 -2.049 12620 0.04044 -0.1158 -0.002584
fixed NA birth_order_nonlinear4 -0.05691 0.0329 -1.73 12710 0.08366 -0.1214 0.007566
fixed NA birth_order_nonlinear5 -0.007878 0.03741 -0.2106 12776 0.8332 -0.08121 0.06545
fixed NA birth_order_nonlinear>5 -0.04945 0.03085 -1.603 13920 0.109 -0.1099 0.01101
ran_pars mother_pidlink sd__(Intercept) 0.2817 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9528 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4334 0.16 2.709 13713 0.006754 0.1198 0.7469
fixed NA poly(age, 3, raw = TRUE)1 -0.03779 0.01526 -2.477 13585 0.01327 -0.0677 -0.007886
fixed NA poly(age, 3, raw = TRUE)2 0.001099 0.0004489 2.448 13365 0.01439 0.000219 0.001979
fixed NA poly(age, 3, raw = TRUE)3 -0.00001087 0.000004131 -2.633 13155 0.008485 -0.00001897 -0.000002778
fixed NA male 0.1706 0.01678 10.16 13800 3.581e-24 0.1377 0.2034
fixed NA count_birth_order2/2 -0.08334 0.04757 -1.752 12613 0.0798 -0.1766 0.009892
fixed NA count_birth_order1/3 -0.0571 0.04482 -1.274 13832 0.2027 -0.1449 0.03074
fixed NA count_birth_order2/3 -0.02348 0.05011 -0.4685 13867 0.6394 -0.1217 0.07474
fixed NA count_birth_order3/3 -0.0652 0.05612 -1.162 13895 0.2454 -0.1752 0.0448
fixed NA count_birth_order1/4 -0.07077 0.05117 -1.383 13871 0.1667 -0.1711 0.02953
fixed NA count_birth_order2/4 -0.009176 0.05382 -0.1705 13881 0.8646 -0.1147 0.0963
fixed NA count_birth_order3/4 -0.1791 0.05847 -3.062 13898 0.002201 -0.2936 -0.06445
fixed NA count_birth_order4/4 -0.07479 0.0619 -1.208 13906 0.227 -0.1961 0.04654
fixed NA count_birth_order1/5 0.0005729 0.05806 0.009867 13896 0.9921 -0.1132 0.1144
fixed NA count_birth_order2/5 -0.06346 0.06107 -1.039 13905 0.2988 -0.1832 0.05625
fixed NA count_birth_order3/5 -0.07172 0.06269 -1.144 13908 0.2526 -0.1946 0.05114
fixed NA count_birth_order4/5 -0.02146 0.0664 -0.3232 13910 0.7465 -0.1516 0.1087
fixed NA count_birth_order5/5 -0.03514 0.06788 -0.5177 13910 0.6046 -0.1682 0.09789
fixed NA count_birth_order1/>5 -0.06634 0.04689 -1.415 13909 0.1571 -0.1582 0.02555
fixed NA count_birth_order2/>5 -0.07713 0.04836 -1.595 13910 0.1108 -0.1719 0.01766
fixed NA count_birth_order3/>5 -0.1038 0.04738 -2.19 13910 0.02853 -0.1966 -0.01091
fixed NA count_birth_order4/>5 -0.1541 0.04643 -3.319 13910 0.0009054 -0.2451 -0.06311
fixed NA count_birth_order5/>5 -0.06927 0.04678 -1.481 13909 0.1387 -0.161 0.02241
fixed NA count_birth_order>5/>5 -0.1164 0.0364 -3.198 12676 0.001387 -0.1877 -0.04506
ran_pars mother_pidlink sd__(Intercept) 0.2812 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.953 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 39311 39394 -19645 39289 NA NA NA
12 39310 39400 -19643 39286 3.706 1 0.05421
16 39315 39435 -19641 39283 3.124 4 0.5373
26 39324 39521 -19636 39272 10.07 10 0.4341

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.833 0.4144 -2.01 5898 0.04449 -1.645 -0.02067
fixed NA poly(age, 3, raw = TRUE)1 0.1105 0.04703 2.349 5903 0.01885 0.0183 0.2026
fixed NA poly(age, 3, raw = TRUE)2 -0.004051 0.001678 -2.414 5908 0.01581 -0.00734 -0.0007618
fixed NA poly(age, 3, raw = TRUE)3 0.00004751 0.000019 2.5 5911 0.01245 0.00001026 0.00008475
fixed NA male 0.1386 0.02423 5.719 5858 0.00000001124 0.09108 0.1861
fixed NA sibling_count3 -0.09714 0.03779 -2.571 4467 0.01018 -0.1712 -0.02308
fixed NA sibling_count4 -0.08943 0.04063 -2.201 3920 0.02778 -0.1691 -0.009798
fixed NA sibling_count5 -0.1136 0.04629 -2.453 3478 0.01421 -0.2043 -0.02283
fixed NA sibling_count>5 -0.1441 0.04061 -3.548 3230 0.0003942 -0.2237 -0.06447
ran_pars mother_pidlink sd__(Intercept) 0.2961 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8871 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8361 0.4145 -2.017 5897 0.04374 -1.649 -0.02365
fixed NA birth_order 0.003801 0.007987 0.4758 5757 0.6342 -0.01185 0.01946
fixed NA poly(age, 3, raw = TRUE)1 0.1103 0.04703 2.345 5902 0.01904 0.01813 0.2025
fixed NA poly(age, 3, raw = TRUE)2 -0.004051 0.001678 -2.414 5907 0.01581 -0.007341 -0.0007619
fixed NA poly(age, 3, raw = TRUE)3 0.00004766 0.00001901 2.507 5910 0.01219 0.00001041 0.00008491
fixed NA male 0.1384 0.02423 5.711 5858 0.00000001176 0.0909 0.1859
fixed NA sibling_count3 -0.09898 0.03799 -2.606 4471 0.009196 -0.1734 -0.02453
fixed NA sibling_count4 -0.09377 0.04164 -2.252 3925 0.02438 -0.1754 -0.01216
fixed NA sibling_count5 -0.1207 0.04866 -2.481 3554 0.01317 -0.2161 -0.02533
fixed NA sibling_count>5 -0.1583 0.0505 -3.136 3749 0.001727 -0.2573 -0.05937
ran_pars mother_pidlink sd__(Intercept) 0.296 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8872 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8633 0.4151 -2.08 5897 0.03758 -1.677 -0.04975
fixed NA poly(age, 3, raw = TRUE)1 0.113 0.04705 2.402 5900 0.01634 0.02079 0.2052
fixed NA poly(age, 3, raw = TRUE)2 -0.00414 0.001679 -2.466 5904 0.01369 -0.007431 -0.0008496
fixed NA poly(age, 3, raw = TRUE)3 0.0000485 0.00001902 2.55 5907 0.01079 0.00001123 0.00008577
fixed NA male 0.1388 0.02423 5.727 5852 0.00000001074 0.09127 0.1862
fixed NA sibling_count3 -0.0928 0.03879 -2.392 4656 0.01677 -0.1688 -0.01678
fixed NA sibling_count4 -0.09456 0.04332 -2.183 4267 0.02912 -0.1795 -0.009643
fixed NA sibling_count5 -0.1389 0.05122 -2.712 4011 0.006717 -0.2393 -0.03852
fixed NA sibling_count>5 -0.146 0.05205 -2.806 4036 0.005043 -0.248 -0.04402
fixed NA birth_order_nonlinear2 0.02394 0.03144 0.7614 5006 0.4465 -0.03769 0.08556
fixed NA birth_order_nonlinear3 -0.01775 0.03877 -0.4578 5241 0.6471 -0.09373 0.05823
fixed NA birth_order_nonlinear4 0.05292 0.0479 1.105 5396 0.2693 -0.04096 0.1468
fixed NA birth_order_nonlinear5 0.106 0.05983 1.771 5286 0.07654 -0.01128 0.2233
fixed NA birth_order_nonlinear>5 -0.03825 0.05984 -0.6391 5909 0.5228 -0.1555 0.07904
ran_pars mother_pidlink sd__(Intercept) 0.2962 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8869 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8675 0.416 -2.085 5888 0.03708 -1.683 -0.05216
fixed NA poly(age, 3, raw = TRUE)1 0.1149 0.04715 2.436 5890 0.01486 0.02247 0.2073
fixed NA poly(age, 3, raw = TRUE)2 -0.004197 0.001683 -2.494 5894 0.01267 -0.007495 -0.0008982
fixed NA poly(age, 3, raw = TRUE)3 0.00004901 0.00001906 2.571 5897 0.01018 0.00001164 0.00008637
fixed NA male 0.1395 0.02425 5.752 5842 0.000000009252 0.09196 0.187
fixed NA count_birth_order2/2 -0.01995 0.05685 -0.351 5213 0.7256 -0.1314 0.09147
fixed NA count_birth_order1/3 -0.137 0.05008 -2.736 5880 0.00623 -0.2352 -0.03889
fixed NA count_birth_order2/3 -0.07656 0.05472 -1.399 5896 0.1619 -0.1838 0.03069
fixed NA count_birth_order3/3 -0.0773 0.06117 -1.264 5900 0.2064 -0.1972 0.04259
fixed NA count_birth_order1/4 -0.07394 0.06123 -1.208 5891 0.2273 -0.194 0.04607
fixed NA count_birth_order2/4 -0.1317 0.06338 -2.078 5900 0.03775 -0.2559 -0.007483
fixed NA count_birth_order3/4 -0.1464 0.06698 -2.186 5897 0.02884 -0.2777 -0.01516
fixed NA count_birth_order4/4 -0.02691 0.06964 -0.3864 5895 0.6992 -0.1634 0.1096
fixed NA count_birth_order1/5 -0.1685 0.08317 -2.026 5900 0.0428 -0.3315 -0.005496
fixed NA count_birth_order2/5 -0.05147 0.08905 -0.578 5889 0.5633 -0.226 0.1231
fixed NA count_birth_order3/5 -0.2027 0.08347 -2.428 5888 0.01521 -0.3663 -0.03908
fixed NA count_birth_order4/5 -0.1164 0.08041 -1.448 5892 0.1476 -0.274 0.04115
fixed NA count_birth_order5/5 -0.05156 0.08367 -0.6162 5884 0.5378 -0.2156 0.1124
fixed NA count_birth_order1/>5 -0.1743 0.08252 -2.112 5899 0.03475 -0.336 -0.01253
fixed NA count_birth_order2/>5 -0.06251 0.0817 -0.7651 5894 0.4442 -0.2226 0.09762
fixed NA count_birth_order3/>5 -0.2153 0.08185 -2.631 5879 0.008545 -0.3757 -0.05489
fixed NA count_birth_order4/>5 -0.1316 0.07712 -1.707 5875 0.08787 -0.2828 0.01951
fixed NA count_birth_order5/>5 -0.0526 0.07288 -0.7217 5876 0.4705 -0.1954 0.09024
fixed NA count_birth_order>5/>5 -0.1993 0.05481 -3.636 5364 0.0002797 -0.3067 -0.09185
ran_pars mother_pidlink sd__(Intercept) 0.2959 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8872 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16002 16076 -7990 15980 NA NA NA
12 16004 16084 -7990 15980 0.2274 1 0.6335
16 16005 16112 -7986 15973 7.314 4 0.1202
26 16018 16192 -7983 15966 6.635 10 0.7594

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7636 0.4132 -1.848 5950 0.06468 -1.573 0.04634
fixed NA poly(age, 3, raw = TRUE)1 0.1043 0.04691 2.224 5954 0.02621 0.01237 0.1963
fixed NA poly(age, 3, raw = TRUE)2 -0.003837 0.001674 -2.292 5959 0.02196 -0.007119 -0.0005553
fixed NA poly(age, 3, raw = TRUE)3 0.00004507 0.00001896 2.376 5962 0.01751 0.000007898 0.00008223
fixed NA male 0.1403 0.02414 5.814 5908 0.000000006409 0.09303 0.1876
fixed NA sibling_count3 -0.1248 0.04088 -3.052 4624 0.002283 -0.2049 -0.04466
fixed NA sibling_count4 -0.1013 0.04303 -2.354 4207 0.01864 -0.1856 -0.01694
fixed NA sibling_count5 -0.1191 0.04596 -2.592 3760 0.009571 -0.2092 -0.02906
fixed NA sibling_count>5 -0.134 0.0403 -3.325 3858 0.0008931 -0.213 -0.055
ran_pars mother_pidlink sd__(Intercept) 0.2966 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8872 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7645 0.4133 -1.85 5949 0.06442 -1.575 0.04561
fixed NA birth_order 0.0008314 0.006965 0.1194 5559 0.905 -0.01282 0.01448
fixed NA poly(age, 3, raw = TRUE)1 0.1043 0.04691 2.223 5953 0.02623 0.01236 0.1963
fixed NA poly(age, 3, raw = TRUE)2 -0.003838 0.001674 -2.292 5957 0.02193 -0.00712 -0.0005563
fixed NA poly(age, 3, raw = TRUE)3 0.00004511 0.00001897 2.378 5961 0.01743 0.000007934 0.00008229
fixed NA male 0.1403 0.02414 5.812 5907 0.000000006484 0.09299 0.1876
fixed NA sibling_count3 -0.1252 0.04102 -3.052 4621 0.002288 -0.2056 -0.04478
fixed NA sibling_count4 -0.1022 0.04371 -2.338 4193 0.01943 -0.1879 -0.01652
fixed NA sibling_count5 -0.1206 0.04751 -2.538 3769 0.0112 -0.2137 -0.02745
fixed NA sibling_count>5 -0.137 0.04768 -2.874 4144 0.004076 -0.2305 -0.04357
ran_pars mother_pidlink sd__(Intercept) 0.2967 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8873 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7658 0.4139 -1.85 5949 0.06431 -1.577 0.04536
fixed NA poly(age, 3, raw = TRUE)1 0.1043 0.04693 2.221 5951 0.02636 0.01227 0.1963
fixed NA poly(age, 3, raw = TRUE)2 -0.00383 0.001675 -2.286 5955 0.02228 -0.007114 -0.0005466
fixed NA poly(age, 3, raw = TRUE)3 0.0000449 0.00001898 2.366 5958 0.01803 0.000007699 0.0000821
fixed NA male 0.1403 0.02414 5.81 5902 0.000000006563 0.09296 0.1876
fixed NA sibling_count3 -0.1194 0.04179 -2.857 4777 0.00429 -0.2013 -0.0375
fixed NA sibling_count4 -0.1057 0.04529 -2.333 4488 0.0197 -0.1944 -0.01689
fixed NA sibling_count5 -0.1304 0.04986 -2.614 4182 0.008972 -0.2281 -0.03263
fixed NA sibling_count>5 -0.126 0.04921 -2.561 4450 0.01046 -0.2225 -0.02959
fixed NA birth_order_nonlinear2 0.006196 0.03202 0.1935 5140 0.8466 -0.05657 0.06896
fixed NA birth_order_nonlinear3 -0.02327 0.03865 -0.6022 5366 0.547 -0.09902 0.05247
fixed NA birth_order_nonlinear4 0.05037 0.04648 1.084 5519 0.2785 -0.04073 0.1415
fixed NA birth_order_nonlinear5 0.04243 0.05703 0.744 5482 0.4569 -0.06934 0.1542
fixed NA birth_order_nonlinear>5 -0.04304 0.05343 -0.8055 5943 0.4206 -0.1478 0.06169
ran_pars mother_pidlink sd__(Intercept) 0.2968 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8872 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7433 0.4145 -1.793 5939 0.073 -1.556 0.06915
fixed NA poly(age, 3, raw = TRUE)1 0.1031 0.04699 2.194 5941 0.02827 0.011 0.1952
fixed NA poly(age, 3, raw = TRUE)2 -0.003777 0.001678 -2.251 5944 0.02442 -0.007065 -0.0004884
fixed NA poly(age, 3, raw = TRUE)3 0.00004418 0.00001901 2.324 5948 0.02016 0.000006919 0.00008145
fixed NA male 0.1401 0.02415 5.801 5891 0.000000006922 0.09278 0.1875
fixed NA count_birth_order2/2 -0.03849 0.0622 -0.6188 5328 0.5361 -0.1604 0.08342
fixed NA count_birth_order1/3 -0.1582 0.05423 -2.917 5931 0.003545 -0.2645 -0.05192
fixed NA count_birth_order2/3 -0.1277 0.05882 -2.171 5946 0.03 -0.243 -0.01239
fixed NA count_birth_order3/3 -0.1121 0.0662 -1.693 5951 0.09043 -0.2418 0.01764
fixed NA count_birth_order1/4 -0.1371 0.06414 -2.138 5942 0.03256 -0.2628 -0.01142
fixed NA count_birth_order2/4 -0.1088 0.06536 -1.665 5950 0.09598 -0.2369 0.01928
fixed NA count_birth_order3/4 -0.2025 0.07174 -2.823 5948 0.004773 -0.3431 -0.06191
fixed NA count_birth_order4/4 0.008894 0.07396 0.1203 5948 0.9043 -0.1361 0.1539
fixed NA count_birth_order1/5 -0.1709 0.07612 -2.245 5950 0.0248 -0.3201 -0.02171
fixed NA count_birth_order2/5 -0.161 0.08176 -1.969 5947 0.04903 -0.3212 -0.0007141
fixed NA count_birth_order3/5 -0.1594 0.07951 -2.004 5944 0.04509 -0.3152 -0.003521
fixed NA count_birth_order4/5 -0.03537 0.08242 -0.4291 5936 0.6679 -0.1969 0.1262
fixed NA count_birth_order5/5 -0.1204 0.08264 -1.457 5935 0.1453 -0.2823 0.0416
fixed NA count_birth_order1/>5 -0.084 0.07236 -1.161 5950 0.2457 -0.2258 0.05781
fixed NA count_birth_order2/>5 -0.08335 0.0756 -1.103 5947 0.2703 -0.2315 0.06482
fixed NA count_birth_order3/>5 -0.17 0.07416 -2.293 5939 0.02188 -0.3154 -0.0247
fixed NA count_birth_order4/>5 -0.201 0.07138 -2.816 5937 0.004873 -0.3409 -0.06113
fixed NA count_birth_order5/>5 -0.08702 0.07335 -1.186 5920 0.2355 -0.2308 0.05674
fixed NA count_birth_order>5/>5 -0.1847 0.05372 -3.439 5495 0.0005887 -0.29 -0.07944
ran_pars mother_pidlink sd__(Intercept) 0.2977 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8869 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16143 16217 -8061 16121 NA NA NA
12 16145 16225 -8061 16121 0.01427 1 0.9049
16 16149 16256 -8058 16117 4.361 4 0.3594
26 16158 16332 -8053 16106 10.45 10 0.4015

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7587 0.4191 -1.81 5780 0.07031 -1.58 0.06275
fixed NA poly(age, 3, raw = TRUE)1 0.1017 0.04758 2.138 5785 0.03258 0.00846 0.195
fixed NA poly(age, 3, raw = TRUE)2 -0.003723 0.001698 -2.192 5789 0.02841 -0.007051 -0.0003944
fixed NA poly(age, 3, raw = TRUE)3 0.00004357 0.00001924 2.264 5793 0.0236 0.000005855 0.00008128
fixed NA male 0.1344 0.02447 5.493 5740 0.00000004125 0.08644 0.1823
fixed NA sibling_count3 -0.1099 0.03728 -2.949 4351 0.003205 -0.183 -0.03687
fixed NA sibling_count4 -0.09092 0.04034 -2.254 3830 0.02428 -0.17 -0.01184
fixed NA sibling_count5 -0.09754 0.04741 -2.057 3285 0.03975 -0.1905 -0.004609
fixed NA sibling_count>5 -0.1308 0.04103 -3.188 3049 0.001449 -0.2112 -0.05037
ran_pars mother_pidlink sd__(Intercept) 0.2968 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8863 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7619 0.4192 -1.818 5779 0.06917 -1.583 0.05964
fixed NA birth_order 0.004791 0.008228 0.5822 5679 0.5604 -0.01134 0.02092
fixed NA poly(age, 3, raw = TRUE)1 0.1014 0.04758 2.131 5784 0.03309 0.008162 0.1947
fixed NA poly(age, 3, raw = TRUE)2 -0.003721 0.001698 -2.191 5788 0.02848 -0.00705 -0.0003926
fixed NA poly(age, 3, raw = TRUE)3 0.00004374 0.00001924 2.273 5792 0.02307 0.000006022 0.00008146
fixed NA male 0.1343 0.02447 5.487 5739 0.00000004254 0.08631 0.1822
fixed NA sibling_count3 -0.1123 0.0375 -2.994 4354 0.002767 -0.1858 -0.03878
fixed NA sibling_count4 -0.09632 0.0414 -2.327 3848 0.02004 -0.1775 -0.01518
fixed NA sibling_count5 -0.1061 0.04965 -2.137 3361 0.03265 -0.2034 -0.008801
fixed NA sibling_count>5 -0.1486 0.05122 -2.902 3668 0.003734 -0.249 -0.04824
ran_pars mother_pidlink sd__(Intercept) 0.2968 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8863 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7727 0.4197 -1.841 5780 0.06568 -1.595 0.04996
fixed NA poly(age, 3, raw = TRUE)1 0.1028 0.0476 2.16 5782 0.0308 0.009528 0.1961
fixed NA poly(age, 3, raw = TRUE)2 -0.003761 0.001699 -2.214 5785 0.02689 -0.007092 -0.0004311
fixed NA poly(age, 3, raw = TRUE)3 0.00004398 0.00001926 2.284 5788 0.02242 0.000006237 0.00008172
fixed NA male 0.1339 0.02447 5.473 5734 0.00000004602 0.08598 0.1819
fixed NA sibling_count3 -0.1077 0.03832 -2.811 4541 0.004962 -0.1828 -0.03261
fixed NA sibling_count4 -0.1011 0.04312 -2.345 4186 0.01908 -0.1856 -0.0166
fixed NA sibling_count5 -0.1219 0.05202 -2.344 3762 0.01913 -0.2239 -0.01998
fixed NA sibling_count>5 -0.1329 0.05286 -2.514 3966 0.01199 -0.2365 -0.02927
fixed NA birth_order_nonlinear2 0.01259 0.03137 0.4012 4886 0.6883 -0.0489 0.07407
fixed NA birth_order_nonlinear3 -0.007885 0.03878 -0.2033 5100 0.8389 -0.08389 0.06812
fixed NA birth_order_nonlinear4 0.06473 0.0493 1.313 5262 0.1892 -0.03189 0.1613
fixed NA birth_order_nonlinear5 0.07644 0.06242 1.225 5174 0.2208 -0.04591 0.1988
fixed NA birth_order_nonlinear>5 -0.03802 0.06175 -0.6156 5785 0.5382 -0.159 0.08301
ran_pars mother_pidlink sd__(Intercept) 0.2956 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.8866 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.7574 0.4207 -1.8 5771 0.07189 -1.582 0.06723
fixed NA poly(age, 3, raw = TRUE)1 0.1027 0.04771 2.152 5772 0.0314 0.009185 0.1962
fixed NA poly(age, 3, raw = TRUE)2 -0.003749 0.001703 -2.201 5776 0.02778 -0.007088 -0.0004106
fixed NA poly(age, 3, raw = TRUE)3 0.00004374 0.00001931 2.266 5779 0.02352 0.0000059 0.00008159
fixed NA male 0.1337 0.02449 5.46 5723 0.00000004957 0.08574 0.1818
fixed NA count_birth_order2/2 -0.03314 0.05536 -0.5986 5061 0.5495 -0.1417 0.07537
fixed NA count_birth_order1/3 -0.1392 0.04945 -2.815 5760 0.004896 -0.2361 -0.04228
fixed NA count_birth_order2/3 -0.1234 0.05468 -2.257 5779 0.02403 -0.2306 -0.01625
fixed NA count_birth_order3/3 -0.08378 0.06007 -1.395 5780 0.1632 -0.2015 0.03395
fixed NA count_birth_order1/4 -0.1067 0.06151 -1.735 5775 0.08283 -0.2273 0.01385
fixed NA count_birth_order2/4 -0.1168 0.06327 -1.846 5781 0.065 -0.2408 0.007236
fixed NA count_birth_order3/4 -0.1429 0.06628 -2.156 5776 0.0311 -0.2728 -0.01301
fixed NA count_birth_order4/4 -0.02894 0.07005 -0.4132 5772 0.6795 -0.1662 0.1084
fixed NA count_birth_order1/5 -0.2023 0.08297 -2.438 5781 0.0148 -0.3649 -0.03966
fixed NA count_birth_order2/5 -0.03606 0.0917 -0.3932 5768 0.6942 -0.2158 0.1437
fixed NA count_birth_order3/5 -0.1885 0.08748 -2.154 5766 0.03125 -0.3599 -0.01701
fixed NA count_birth_order4/5 -0.05182 0.08429 -0.6147 5771 0.5388 -0.217 0.1134
fixed NA count_birth_order5/5 -0.04479 0.08956 -0.5001 5763 0.617 -0.2203 0.1307
fixed NA count_birth_order1/>5 -0.1186 0.08445 -1.404 5778 0.1603 -0.2841 0.04694
fixed NA count_birth_order2/>5 -0.06131 0.08375 -0.7321 5774 0.4642 -0.2255 0.1028
fixed NA count_birth_order3/>5 -0.1921 0.08298 -2.315 5757 0.02065 -0.3548 -0.02946
fixed NA count_birth_order4/>5 -0.1344 0.08117 -1.656 5743 0.09781 -0.2935 0.02468
fixed NA count_birth_order5/>5 -0.08222 0.0746 -1.102 5753 0.2704 -0.2284 0.06399
fixed NA count_birth_order>5/>5 -0.1868 0.05579 -3.349 5198 0.000818 -0.2961 -0.07746
ran_pars mother_pidlink sd__(Intercept) 0.2954 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.887 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15673 15746 -7826 15651 NA NA NA
12 15675 15755 -7825 15651 0.3398 1 0.5599
16 15678 15785 -7823 15646 4.718 4 0.3175
26 15692 15865 -7820 15640 6.553 10 0.7669

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Risk preference

Risk A

birthorder <- birthorder %>% mutate(outcome = riskA)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.147 0.1737 6.604 11994 0.0000000000418 0.8068 1.488
fixed NA poly(age, 3, raw = TRUE)1 -0.09252 0.01678 -5.513 11800 0.00000003595 -0.1254 -0.05963
fixed NA poly(age, 3, raw = TRUE)2 0.002406 0.0004989 4.822 11527 0.000001438 0.001428 0.003383
fixed NA poly(age, 3, raw = TRUE)3 -0.00001908 0.000004653 -4.1 11257 0.00004163 -0.00002819 -0.000009956
fixed NA male -0.2332 0.01776 -13.13 12290 3.886e-39 -0.268 -0.1984
fixed NA sibling_count3 0.003204 0.03507 0.09136 9926 0.9272 -0.06554 0.07195
fixed NA sibling_count4 0.004187 0.03594 0.1165 9135 0.9073 -0.06626 0.07464
fixed NA sibling_count5 -0.008956 0.03722 -0.2406 8113 0.8098 -0.0819 0.06399
fixed NA sibling_count>5 0.04878 0.02933 1.663 9175 0.09638 -0.008715 0.1063
ran_pars mother_pidlink sd__(Intercept) 0.2501 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9575 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.149 0.1738 6.615 11995 0.00000000003867 0.8089 1.49
fixed NA birth_order 0.002926 0.003685 0.794 10092 0.4272 -0.004297 0.01015
fixed NA poly(age, 3, raw = TRUE)1 -0.09344 0.01682 -5.555 11775 0.00000002835 -0.1264 -0.06047
fixed NA poly(age, 3, raw = TRUE)2 0.002438 0.0005005 4.871 11459 0.000001126 0.001457 0.003419
fixed NA poly(age, 3, raw = TRUE)3 -0.00001937 0.000004668 -4.15 11169 0.00003342 -0.00002852 -0.00001022
fixed NA male -0.2333 0.01776 -13.14 12289 3.698e-39 -0.2681 -0.1985
fixed NA sibling_count3 0.002364 0.03509 0.06739 9936 0.9463 -0.0664 0.07113
fixed NA sibling_count4 0.002011 0.03604 0.05579 9175 0.9555 -0.06863 0.07265
fixed NA sibling_count5 -0.01272 0.03751 -0.3391 8187 0.7346 -0.08624 0.0608
fixed NA sibling_count>5 0.03741 0.03264 1.146 9887 0.2517 -0.02656 0.1014
ran_pars mother_pidlink sd__(Intercept) 0.2494 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9577 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.134 0.1743 6.508 11992 0.00000000007936 0.7926 1.476
fixed NA poly(age, 3, raw = TRUE)1 -0.09246 0.01683 -5.495 11783 0.00000003986 -0.1254 -0.05948
fixed NA poly(age, 3, raw = TRUE)2 0.002401 0.0005007 4.795 11465 0.000001648 0.001419 0.003382
fixed NA poly(age, 3, raw = TRUE)3 -0.00001898 0.00000467 -4.064 11162 0.00004865 -0.00002813 -0.000009823
fixed NA male -0.2334 0.01776 -13.14 12284 3.363e-39 -0.2682 -0.1986
fixed NA sibling_count3 0.00682 0.03566 0.1912 10217 0.8484 -0.06308 0.07672
fixed NA sibling_count4 0.006205 0.03719 0.1669 9772 0.8675 -0.06668 0.07909
fixed NA sibling_count5 -0.01895 0.03919 -0.4834 9054 0.6288 -0.09576 0.05787
fixed NA sibling_count>5 0.04327 0.03453 1.253 10833 0.2102 -0.02441 0.111
fixed NA birth_order_nonlinear2 0.03422 0.02611 1.311 11515 0.1899 -0.01694 0.08539
fixed NA birth_order_nonlinear3 -0.005286 0.0307 -0.1722 11400 0.8633 -0.06545 0.05488
fixed NA birth_order_nonlinear4 0.015 0.03513 0.4268 11505 0.6695 -0.05386 0.08385
fixed NA birth_order_nonlinear5 0.08311 0.03947 2.106 11550 0.03526 0.005747 0.1605
fixed NA birth_order_nonlinear>5 0.009131 0.03275 0.2789 12349 0.7804 -0.05505 0.07331
ran_pars mother_pidlink sd__(Intercept) 0.2505 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9573 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.152 0.175 6.581 11987 0.00000000004863 0.8086 1.495
fixed NA poly(age, 3, raw = TRUE)1 -0.09299 0.01682 -5.528 11770 0.00000003299 -0.126 -0.06002
fixed NA poly(age, 3, raw = TRUE)2 0.002411 0.0005005 4.817 11443 0.000001478 0.00143 0.003392
fixed NA poly(age, 3, raw = TRUE)3 -0.00001901 0.000004669 -4.072 11131 0.00004694 -0.00002816 -0.000009861
fixed NA male -0.2341 0.01775 -13.19 12273 1.866e-39 -0.2689 -0.1993
fixed NA count_birth_order2/2 0.005908 0.05039 0.1173 11387 0.9067 -0.09284 0.1047
fixed NA count_birth_order1/3 -0.04965 0.04725 -1.051 12312 0.2934 -0.1423 0.04296
fixed NA count_birth_order2/3 0.02964 0.05332 0.5559 12329 0.5783 -0.07487 0.1342
fixed NA count_birth_order3/3 0.08396 0.05874 1.429 12340 0.1529 -0.03117 0.1991
fixed NA count_birth_order1/4 0.05371 0.05395 0.9955 12331 0.3195 -0.05203 0.1594
fixed NA count_birth_order2/4 -0.01678 0.05658 -0.2965 12334 0.7668 -0.1277 0.09412
fixed NA count_birth_order3/4 -0.09029 0.06134 -1.472 12344 0.141 -0.2105 0.02993
fixed NA count_birth_order4/4 0.07955 0.06589 1.207 12346 0.2273 -0.0496 0.2087
fixed NA count_birth_order1/5 -0.02778 0.062 -0.4482 12343 0.654 -0.1493 0.09372
fixed NA count_birth_order2/5 0.04518 0.06404 0.7054 12345 0.4806 -0.08035 0.1707
fixed NA count_birth_order3/5 0.01774 0.06616 0.2682 12347 0.7886 -0.1119 0.1474
fixed NA count_birth_order4/5 -0.1898 0.06999 -2.712 12347 0.006689 -0.327 -0.05266
fixed NA count_birth_order5/5 0.1188 0.07047 1.686 12347 0.09189 -0.01933 0.2569
fixed NA count_birth_order1/>5 0.02633 0.04975 0.5293 12347 0.5966 -0.07118 0.1238
fixed NA count_birth_order2/>5 0.1002 0.05139 1.949 12346 0.05127 -0.0005436 0.2009
fixed NA count_birth_order3/>5 -0.006486 0.05003 -0.1296 12346 0.8968 -0.1045 0.09157
fixed NA count_birth_order4/>5 0.0823 0.049 1.68 12347 0.09304 -0.01373 0.1783
fixed NA count_birth_order5/>5 0.09391 0.04895 1.919 12346 0.05505 -0.00202 0.1898
fixed NA count_birth_order>5/>5 0.04251 0.03807 1.116 11430 0.2642 -0.03211 0.1171
ran_pars mother_pidlink sd__(Intercept) 0.2503 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9567 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 34828 34909 -17403 34806 NA NA NA
12 34829 34918 -17403 34805 0.6324 1 0.4265
16 34831 34949 -17399 34799 6.352 4 0.1743
26 34825 35018 -17386 34773 25.71 10 0.004149

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.577 0.4493 3.51 5320 0.000452 0.6964 2.458
fixed NA poly(age, 3, raw = TRUE)1 -0.134 0.05105 -2.626 5322 0.008665 -0.2341 -0.034
fixed NA poly(age, 3, raw = TRUE)2 0.003493 0.001825 1.914 5323 0.05565 -0.00008355 0.007069
fixed NA poly(age, 3, raw = TRUE)3 -0.00002836 0.0000207 -1.37 5324 0.1708 -0.00006894 0.00001222
fixed NA male -0.2542 0.02616 -9.717 5298 3.894e-22 -0.3055 -0.2029
fixed NA sibling_count3 -0.01637 0.04026 -0.4067 4232 0.6843 -0.09528 0.06253
fixed NA sibling_count4 0.01001 0.04325 0.2314 3736 0.817 -0.07475 0.09477
fixed NA sibling_count5 0.02769 0.04899 0.5652 3337 0.5719 -0.06832 0.1237
fixed NA sibling_count>5 0.1299 0.04299 3.021 3120 0.002542 0.0456 0.2141
ran_pars mother_pidlink sd__(Intercept) 0.2518 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9226 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.58 0.4494 3.516 5319 0.0004423 0.6991 2.461
fixed NA birth_order -0.003278 0.008588 -0.3817 5089 0.7027 -0.02011 0.01355
fixed NA poly(age, 3, raw = TRUE)1 -0.1339 0.05105 -2.624 5321 0.008728 -0.234 -0.03387
fixed NA poly(age, 3, raw = TRUE)2 0.003494 0.001825 1.915 5322 0.05557 -0.00008234 0.00707
fixed NA poly(age, 3, raw = TRUE)3 -0.0000285 0.00002071 -1.376 5323 0.1688 -0.00006909 0.00001208
fixed NA male -0.2541 0.02616 -9.71 5297 4.156e-22 -0.3054 -0.2028
fixed NA sibling_count3 -0.01474 0.04049 -0.3641 4234 0.7158 -0.0941 0.06462
fixed NA sibling_count4 0.01385 0.0444 0.3118 3736 0.7552 -0.07318 0.1009
fixed NA sibling_count5 0.03389 0.05161 0.6566 3384 0.5115 -0.06727 0.1351
fixed NA sibling_count>5 0.1424 0.05406 2.634 3552 0.00848 0.03642 0.2483
ran_pars mother_pidlink sd__(Intercept) 0.2515 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9228 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.557 0.4502 3.459 5316 0.0005455 0.6751 2.44
fixed NA poly(age, 3, raw = TRUE)1 -0.1325 0.05109 -2.593 5317 0.009537 -0.2326 -0.03235
fixed NA poly(age, 3, raw = TRUE)2 0.003436 0.001826 1.881 5319 0.05999 -0.0001438 0.007016
fixed NA poly(age, 3, raw = TRUE)3 -0.00002774 0.00002073 -1.338 5319 0.1808 -0.00006837 0.00001289
fixed NA male -0.2537 0.02617 -9.693 5292 4.897e-22 -0.305 -0.2024
fixed NA sibling_count3 -0.02883 0.04149 -0.6949 4391 0.4872 -0.1101 0.05249
fixed NA sibling_count4 0.003924 0.04641 0.08454 4052 0.9326 -0.08704 0.09489
fixed NA sibling_count5 0.01893 0.05466 0.3463 3814 0.7291 -0.08821 0.1261
fixed NA sibling_count>5 0.1267 0.05591 2.266 3862 0.02349 0.01712 0.2363
fixed NA birth_order_nonlinear2 0.01925 0.03437 0.5601 4676 0.5755 -0.04811 0.0866
fixed NA birth_order_nonlinear3 0.05381 0.04222 1.274 4855 0.2026 -0.02895 0.1366
fixed NA birth_order_nonlinear4 -0.02119 0.05203 -0.4073 4967 0.6838 -0.1232 0.08078
fixed NA birth_order_nonlinear5 0.03094 0.0651 0.4752 4899 0.6346 -0.09666 0.1585
fixed NA birth_order_nonlinear>5 -0.00119 0.06463 -0.01842 5316 0.9853 -0.1279 0.1255
ran_pars mother_pidlink sd__(Intercept) 0.2539 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9223 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.526 0.4507 3.385 5306 0.0007173 0.6422 2.409
fixed NA poly(age, 3, raw = TRUE)1 -0.1286 0.05114 -2.514 5307 0.01198 -0.2288 -0.02832
fixed NA poly(age, 3, raw = TRUE)2 0.003327 0.001828 1.82 5308 0.06888 -0.0002567 0.00691
fixed NA poly(age, 3, raw = TRUE)3 -0.00002686 0.00002075 -1.294 5309 0.1956 -0.00006754 0.00001381
fixed NA male -0.2536 0.02619 -9.683 5280 5.417e-22 -0.3049 -0.2022
fixed NA count_birth_order2/2 -0.008658 0.06139 -0.141 4803 0.8879 -0.129 0.1117
fixed NA count_birth_order1/3 -0.1013 0.05393 -1.878 5302 0.06041 -0.207 0.00441
fixed NA count_birth_order2/3 0.01465 0.05898 0.2484 5308 0.8039 -0.1009 0.1302
fixed NA count_birth_order3/3 0.08765 0.06512 1.346 5309 0.1783 -0.03997 0.2153
fixed NA count_birth_order1/4 0.05273 0.06664 0.7913 5305 0.4288 -0.07788 0.1834
fixed NA count_birth_order2/4 -0.01304 0.06801 -0.1917 5309 0.848 -0.1463 0.1203
fixed NA count_birth_order3/4 -0.04041 0.07259 -0.5568 5306 0.5777 -0.1827 0.1019
fixed NA count_birth_order4/4 0.02005 0.07383 0.2715 5306 0.786 -0.1246 0.1647
fixed NA count_birth_order1/5 0.1057 0.08996 1.175 5309 0.2401 -0.07063 0.282
fixed NA count_birth_order2/5 -0.01872 0.09657 -0.1939 5304 0.8463 -0.208 0.1706
fixed NA count_birth_order3/5 0.02719 0.0897 0.3031 5301 0.7618 -0.1486 0.203
fixed NA count_birth_order4/5 0.0244 0.08554 0.2853 5305 0.7754 -0.1432 0.1921
fixed NA count_birth_order5/5 -0.02271 0.08904 -0.2551 5301 0.7987 -0.1972 0.1518
fixed NA count_birth_order1/>5 0.1101 0.09201 1.197 5309 0.2315 -0.07023 0.2905
fixed NA count_birth_order2/>5 0.1728 0.08828 1.957 5308 0.05037 -0.0002416 0.3458
fixed NA count_birth_order3/>5 0.1931 0.08797 2.195 5304 0.0282 0.02068 0.3655
fixed NA count_birth_order4/>5 -0.004091 0.08442 -0.04846 5298 0.9614 -0.1696 0.1614
fixed NA count_birth_order5/>5 0.1929 0.07866 2.452 5297 0.01425 0.03868 0.347
fixed NA count_birth_order>5/>5 0.1152 0.05806 1.985 4842 0.04723 0.001439 0.229
ran_pars mother_pidlink sd__(Intercept) 0.2554 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9215 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 14660 14732 -7319 14638 NA NA NA
12 14661 14740 -7319 14637 0.1468 1 0.7016
16 14667 14772 -7317 14635 2.604 4 0.6262
26 14672 14844 -7310 14620 14.37 10 0.1569

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.549 0.4478 3.46 5369 0.0005442 0.6717 2.427
fixed NA poly(age, 3, raw = TRUE)1 -0.1301 0.05091 -2.555 5371 0.01064 -0.2298 -0.0303
fixed NA poly(age, 3, raw = TRUE)2 0.003384 0.00182 1.859 5372 0.06307 -0.0001836 0.006951
fixed NA poly(age, 3, raw = TRUE)3 -0.00002719 0.00002066 -1.316 5373 0.1882 -0.00006768 0.0000133
fixed NA male -0.2574 0.02605 -9.882 5346 7.785e-23 -0.3085 -0.2064
fixed NA sibling_count3 -0.03451 0.04357 -0.792 4369 0.4284 -0.1199 0.05089
fixed NA sibling_count4 -0.03854 0.04574 -0.8425 3984 0.3995 -0.1282 0.05111
fixed NA sibling_count5 0.02241 0.04858 0.4612 3611 0.6447 -0.07281 0.1176
fixed NA sibling_count>5 0.0725 0.04271 1.697 3685 0.08972 -0.01122 0.1562
ran_pars mother_pidlink sd__(Intercept) 0.2535 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9221 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.545 0.4479 3.45 5368 0.0005658 0.6672 2.423
fixed NA birth_order 0.003578 0.007458 0.4798 4894 0.6314 -0.01104 0.01819
fixed NA poly(age, 3, raw = TRUE)1 -0.1301 0.05091 -2.555 5370 0.01065 -0.2299 -0.03029
fixed NA poly(age, 3, raw = TRUE)2 0.003378 0.00182 1.856 5371 0.06357 -0.00019 0.006945
fixed NA poly(age, 3, raw = TRUE)3 -0.00002699 0.00002066 -1.306 5372 0.1916 -0.00006748 0.00001351
fixed NA male -0.2575 0.02605 -9.886 5345 7.537e-23 -0.3086 -0.2065
fixed NA sibling_count3 -0.03628 0.04373 -0.8296 4365 0.4068 -0.122 0.04943
fixed NA sibling_count4 -0.04254 0.0465 -0.9149 3969 0.3603 -0.1337 0.0486
fixed NA sibling_count5 0.01616 0.0503 0.3213 3609 0.748 -0.08242 0.1147
fixed NA sibling_count>5 0.0592 0.05092 1.163 3896 0.245 -0.04059 0.159
ran_pars mother_pidlink sd__(Intercept) 0.2537 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9222 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.522 0.4487 3.392 5366 0.0006988 0.6425 2.401
fixed NA poly(age, 3, raw = TRUE)1 -0.128 0.05094 -2.513 5367 0.01201 -0.2279 -0.02816
fixed NA poly(age, 3, raw = TRUE)2 0.003294 0.001822 1.808 5368 0.07066 -0.0002767 0.006864
fixed NA poly(age, 3, raw = TRUE)3 -0.00002588 0.00002068 -1.252 5368 0.2108 -0.00006642 0.00001465
fixed NA male -0.2576 0.02605 -9.888 5340 7.394e-23 -0.3086 -0.2065
fixed NA sibling_count3 -0.05732 0.04465 -1.284 4491 0.1994 -0.1448 0.03021
fixed NA sibling_count4 -0.06546 0.04836 -1.354 4231 0.1759 -0.1602 0.02932
fixed NA sibling_count5 -0.0008842 0.05303 -0.01667 3990 0.9867 -0.1048 0.103
fixed NA sibling_count>5 0.0348 0.05268 0.6606 4203 0.5089 -0.06845 0.138
fixed NA birth_order_nonlinear2 0.03458 0.03489 0.9911 4780 0.3217 -0.0338 0.103
fixed NA birth_order_nonlinear3 0.09857 0.04209 2.342 4959 0.01921 0.01609 0.1811
fixed NA birth_order_nonlinear4 0.0352 0.05032 0.6995 5072 0.4843 -0.06343 0.1338
fixed NA birth_order_nonlinear5 0.003997 0.06168 0.06481 5041 0.9483 -0.1169 0.1249
fixed NA birth_order_nonlinear>5 0.07155 0.05752 1.244 5334 0.2136 -0.0412 0.1843
ran_pars mother_pidlink sd__(Intercept) 0.2558 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9214 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.49 0.4492 3.317 5356 0.0009158 0.6097 2.371
fixed NA poly(age, 3, raw = TRUE)1 -0.1225 0.05098 -2.404 5356 0.01627 -0.2224 -0.02261
fixed NA poly(age, 3, raw = TRUE)2 0.003108 0.001823 1.705 5357 0.08829 -0.0004651 0.006681
fixed NA poly(age, 3, raw = TRUE)3 -0.00002392 0.0000207 -1.156 5358 0.2478 -0.00006449 0.00001665
fixed NA male -0.2572 0.02606 -9.871 5329 8.746e-23 -0.3083 -0.2061
fixed NA count_birth_order2/2 -0.01902 0.06687 -0.2844 4888 0.7761 -0.1501 0.112
fixed NA count_birth_order1/3 -0.1438 0.05846 -2.46 5351 0.01392 -0.2584 -0.02923
fixed NA count_birth_order2/3 0.003974 0.06319 0.0629 5356 0.9498 -0.1199 0.1278
fixed NA count_birth_order3/3 0.08898 0.0708 1.257 5358 0.2089 -0.04978 0.2277
fixed NA count_birth_order1/4 -0.01275 0.06936 -0.1838 5355 0.8541 -0.1487 0.1232
fixed NA count_birth_order2/4 -0.1237 0.07019 -1.762 5358 0.07817 -0.2612 0.01391
fixed NA count_birth_order3/4 -0.04247 0.07755 -0.5477 5356 0.5839 -0.1945 0.1095
fixed NA count_birth_order4/4 0.01075 0.07811 0.1376 5356 0.8905 -0.1423 0.1638
fixed NA count_birth_order1/5 0.01399 0.08174 0.1712 5358 0.8641 -0.1462 0.1742
fixed NA count_birth_order2/5 0.009527 0.08838 0.1078 5356 0.9142 -0.1637 0.1827
fixed NA count_birth_order3/5 0.1061 0.08479 1.251 5354 0.211 -0.06012 0.2722
fixed NA count_birth_order4/5 0.02947 0.08793 0.3351 5351 0.7375 -0.1429 0.2018
fixed NA count_birth_order5/5 -0.0916 0.08745 -1.047 5349 0.295 -0.263 0.07981
fixed NA count_birth_order1/>5 0.001461 0.07901 0.01849 5357 0.9852 -0.1534 0.1563
fixed NA count_birth_order2/>5 0.1332 0.08149 1.635 5357 0.1021 -0.02647 0.293
fixed NA count_birth_order3/>5 0.06555 0.08021 0.8172 5354 0.4139 -0.09166 0.2228
fixed NA count_birth_order4/>5 -0.01491 0.07757 -0.1922 5351 0.8476 -0.1669 0.1371
fixed NA count_birth_order5/>5 0.07852 0.07906 0.9931 5342 0.3207 -0.07644 0.2335
fixed NA count_birth_order>5/>5 0.08841 0.05687 1.555 4983 0.1201 -0.02305 0.1999
ran_pars mother_pidlink sd__(Intercept) 0.2571 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9206 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 14794 14866 -7386 14772 NA NA NA
12 14796 14875 -7386 14772 0.2304 1 0.6312
16 14797 14903 -7383 14765 6.297 4 0.178
26 14802 14973 -7375 14750 15.5 10 0.1149

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.476 0.455 3.243 5219 0.00119 0.5838 2.367
fixed NA poly(age, 3, raw = TRUE)1 -0.1219 0.05172 -2.358 5221 0.01842 -0.2233 -0.02058
fixed NA poly(age, 3, raw = TRUE)2 0.003027 0.00185 1.637 5222 0.1018 -0.000598 0.006652
fixed NA poly(age, 3, raw = TRUE)3 -0.00002277 0.00002101 -1.084 5223 0.2784 -0.00006394 0.0000184
fixed NA male -0.259 0.02642 -9.801 5196 1.743e-22 -0.3108 -0.2072
fixed NA sibling_count3 -0.01595 0.03977 -0.4011 4134 0.6884 -0.09389 0.06199
fixed NA sibling_count4 0.002577 0.04305 0.05986 3673 0.9523 -0.0818 0.08695
fixed NA sibling_count5 0.06957 0.05029 1.383 3182 0.1666 -0.02899 0.1681
fixed NA sibling_count>5 0.1304 0.04352 2.997 2969 0.002745 0.04515 0.2157
ran_pars mother_pidlink sd__(Intercept) 0.255 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.922 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.477 0.4551 3.246 5218 0.001177 0.5854 2.369
fixed NA birth_order -0.002007 0.008824 -0.2275 5012 0.8201 -0.0193 0.01529
fixed NA poly(age, 3, raw = TRUE)1 -0.1219 0.05173 -2.356 5220 0.01851 -0.2233 -0.02048
fixed NA poly(age, 3, raw = TRUE)2 0.003028 0.00185 1.637 5221 0.1017 -0.0005978 0.006653
fixed NA poly(age, 3, raw = TRUE)3 -0.00002285 0.00002101 -1.088 5222 0.2768 -0.00006403 0.00001833
fixed NA male -0.2589 0.02643 -9.798 5195 1.79e-22 -0.3107 -0.2071
fixed NA sibling_count3 -0.01493 0.04002 -0.3731 4132 0.7091 -0.09337 0.06351
fixed NA sibling_count4 0.004905 0.04426 0.1108 3679 0.9118 -0.08183 0.09164
fixed NA sibling_count5 0.0732 0.05277 1.387 3230 0.1655 -0.03022 0.1766
fixed NA sibling_count>5 0.1381 0.0549 2.515 3487 0.01196 0.03046 0.2456
ran_pars mother_pidlink sd__(Intercept) 0.2549 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9221 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.46 0.4559 3.203 5215 0.00137 0.5665 2.354
fixed NA poly(age, 3, raw = TRUE)1 -0.1207 0.05177 -2.332 5217 0.01975 -0.2222 -0.01925
fixed NA poly(age, 3, raw = TRUE)2 0.002979 0.001851 1.609 5217 0.1077 -0.0006496 0.006607
fixed NA poly(age, 3, raw = TRUE)3 -0.00002217 0.00002103 -1.054 5218 0.2918 -0.00006339 0.00001905
fixed NA male -0.2584 0.02643 -9.775 5190 2.242e-22 -0.3102 -0.2066
fixed NA sibling_count3 -0.02704 0.04106 -0.6587 4293 0.5101 -0.1075 0.05342
fixed NA sibling_count4 -0.002276 0.04631 -0.04916 3991 0.9608 -0.09303 0.08848
fixed NA sibling_count5 0.06283 0.0556 1.13 3618 0.2585 -0.04614 0.1718
fixed NA sibling_count>5 0.1202 0.05686 2.113 3802 0.03465 0.008714 0.2316
fixed NA birth_order_nonlinear2 0.01531 0.03429 0.4465 4577 0.6553 -0.05189 0.08251
fixed NA birth_order_nonlinear3 0.04702 0.04216 1.115 4732 0.2647 -0.03561 0.1297
fixed NA birth_order_nonlinear4 -0.02296 0.05335 -0.4304 4862 0.6669 -0.1275 0.08161
fixed NA birth_order_nonlinear5 0.02594 0.06801 0.3815 4794 0.7029 -0.1073 0.1592
fixed NA birth_order_nonlinear>5 0.01797 0.0667 0.2694 5217 0.7877 -0.1128 0.1487
ran_pars mother_pidlink sd__(Intercept) 0.2571 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9217 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.418 0.4564 3.108 5205 0.001896 0.5238 2.313
fixed NA poly(age, 3, raw = TRUE)1 -0.1144 0.05181 -2.207 5206 0.02734 -0.2159 -0.01281
fixed NA poly(age, 3, raw = TRUE)2 0.002775 0.001853 1.497 5207 0.1343 -0.0008571 0.006406
fixed NA poly(age, 3, raw = TRUE)3 -0.00002013 0.00002105 -0.9565 5208 0.3388 -0.00006139 0.00002112
fixed NA male -0.2579 0.02644 -9.756 5178 2.713e-22 -0.3098 -0.2061
fixed NA count_birth_order2/2 -0.03894 0.05986 -0.6506 4693 0.5154 -0.1563 0.07838
fixed NA count_birth_order1/3 -0.1122 0.05335 -2.103 5200 0.03548 -0.2168 -0.007653
fixed NA count_birth_order2/3 -0.005963 0.05896 -0.1011 5208 0.9194 -0.1215 0.1096
fixed NA count_birth_order3/3 0.0912 0.06371 1.432 5207 0.1523 -0.03367 0.2161
fixed NA count_birth_order1/4 0.0365 0.06697 0.5451 5206 0.5857 -0.09475 0.1678
fixed NA count_birth_order2/4 0.00438 0.06821 0.06421 5208 0.9488 -0.1293 0.1381
fixed NA count_birth_order3/4 -0.08139 0.07209 -1.129 5203 0.259 -0.2227 0.05991
fixed NA count_birth_order4/4 -0.01876 0.07401 -0.2534 5202 0.7999 -0.1638 0.1263
fixed NA count_birth_order1/5 0.1228 0.09013 1.362 5208 0.1733 -0.0539 0.2994
fixed NA count_birth_order2/5 0.01063 0.09959 0.1067 5202 0.915 -0.1846 0.2058
fixed NA count_birth_order3/5 0.05929 0.09337 0.6351 5199 0.5254 -0.1237 0.2423
fixed NA count_birth_order4/5 0.09376 0.09014 1.04 5203 0.2983 -0.0829 0.2704
fixed NA count_birth_order5/5 -0.02808 0.09563 -0.2937 5199 0.769 -0.2155 0.1594
fixed NA count_birth_order1/>5 0.08835 0.09431 0.9368 5207 0.3489 -0.09649 0.2732
fixed NA count_birth_order2/>5 0.1599 0.09032 1.771 5206 0.07668 -0.0171 0.3369
fixed NA count_birth_order3/>5 0.1489 0.08977 1.659 5200 0.09721 -0.02704 0.3249
fixed NA count_birth_order4/>5 -0.02845 0.0881 -0.3229 5193 0.7468 -0.2011 0.1442
fixed NA count_birth_order5/>5 0.1909 0.08075 2.365 5193 0.01809 0.03267 0.3492
fixed NA count_birth_order>5/>5 0.119 0.05923 2.01 4696 0.0445 0.002956 0.2351
ran_pars mother_pidlink sd__(Intercept) 0.2591 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9205 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 14385 14457 -7181 14363 NA NA NA
12 14386 14465 -7181 14362 0.05235 1 0.819
16 14392 14497 -7180 14360 2.057 4 0.7253
26 14395 14565 -7171 14343 17.69 10 0.06035

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Risk B

birthorder <- birthorder %>% mutate(outcome = riskB)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3885 0.1683 2.309 12765 0.02098 0.05867 0.7184
fixed NA poly(age, 3, raw = TRUE)1 -0.02493 0.01621 -1.537 12562 0.1242 -0.05671 0.00685
fixed NA poly(age, 3, raw = TRUE)2 0.0007458 0.0004805 1.552 12293 0.1206 -0.0001959 0.001688
fixed NA poly(age, 3, raw = TRUE)3 -0.000007326 0.000004462 -1.642 12042 0.1007 -0.00001607 0.00000142
fixed NA male -0.1892 0.01731 -10.93 13119 1.054e-27 -0.2231 -0.1553
fixed NA sibling_count3 -0.02192 0.03395 -0.6458 10321 0.5184 -0.08846 0.04461
fixed NA sibling_count4 -0.00809 0.03496 -0.2314 9498 0.817 -0.07661 0.06043
fixed NA sibling_count5 -0.03174 0.03599 -0.8819 8323 0.3779 -0.1023 0.0388
fixed NA sibling_count>5 -0.04519 0.0285 -1.586 9488 0.1129 -0.1011 0.01067
ran_pars mother_pidlink sd__(Intercept) 0.2164 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.969 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3874 0.1683 2.301 12768 0.02139 0.05746 0.7173
fixed NA birth_order -0.001201 0.003596 -0.3339 10334 0.7384 -0.008249 0.005847
fixed NA poly(age, 3, raw = TRUE)1 -0.02453 0.01626 -1.509 12531 0.1314 -0.05639 0.007339
fixed NA poly(age, 3, raw = TRUE)2 0.000732 0.0004823 1.518 12211 0.1291 -0.0002132 0.001677
fixed NA poly(age, 3, raw = TRUE)3 -0.0000072 0.000004478 -1.608 11938 0.1079 -0.00001598 0.000001577
fixed NA male -0.1892 0.01731 -10.93 13118 1.098e-27 -0.2231 -0.1552
fixed NA sibling_count3 -0.02161 0.03396 -0.6363 10335 0.5246 -0.08817 0.04495
fixed NA sibling_count4 -0.007222 0.03506 -0.206 9548 0.8368 -0.07594 0.06149
fixed NA sibling_count5 -0.03024 0.03627 -0.8337 8416 0.4045 -0.1013 0.04085
fixed NA sibling_count>5 -0.04059 0.03166 -1.282 10305 0.1999 -0.1026 0.02147
ran_pars mother_pidlink sd__(Intercept) 0.2165 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.969 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.3921 0.1689 2.321 12768 0.02028 0.06105 0.7231
fixed NA poly(age, 3, raw = TRUE)1 -0.02604 0.01627 -1.601 12546 0.1095 -0.05792 0.005844
fixed NA poly(age, 3, raw = TRUE)2 0.0007753 0.0004825 1.607 12226 0.1081 -0.0001703 0.001721
fixed NA poly(age, 3, raw = TRUE)3 -0.000007514 0.00000448 -1.677 11940 0.09356 -0.0000163 0.000001268
fixed NA male -0.1895 0.01731 -10.95 13113 9.203e-28 -0.2234 -0.1555
fixed NA sibling_count3 -0.03004 0.0345 -0.8706 10641 0.384 -0.09766 0.03758
fixed NA sibling_count4 -0.01974 0.03616 -0.546 10203 0.5851 -0.09061 0.05112
fixed NA sibling_count5 -0.04581 0.0379 -1.209 9357 0.2268 -0.1201 0.02847
fixed NA sibling_count>5 -0.06451 0.03346 -1.928 11369 0.05388 -0.1301 0.001068
fixed NA birth_order_nonlinear2 0.01757 0.02529 0.6947 12145 0.4873 -0.032 0.06714
fixed NA birth_order_nonlinear3 0.04294 0.02996 1.433 12111 0.1519 -0.01579 0.1017
fixed NA birth_order_nonlinear4 0.02767 0.03418 0.8097 12211 0.4182 -0.03932 0.09466
fixed NA birth_order_nonlinear5 0.0263 0.03854 0.6825 12265 0.4949 -0.04923 0.1018
fixed NA birth_order_nonlinear>5 0.03267 0.03179 1.028 13117 0.3041 -0.02964 0.09498
ran_pars mother_pidlink sd__(Intercept) 0.217 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.969 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4261 0.1695 2.513 12765 0.01197 0.09383 0.7585
fixed NA poly(age, 3, raw = TRUE)1 -0.02658 0.01626 -1.635 12534 0.1022 -0.05845 0.005291
fixed NA poly(age, 3, raw = TRUE)2 0.0007872 0.0004824 1.632 12206 0.1027 -0.0001582 0.001733
fixed NA poly(age, 3, raw = TRUE)3 -0.00000757 0.00000448 -1.69 11909 0.09112 -0.00001635 0.000001211
fixed NA male -0.1896 0.0173 -10.96 13103 8.252e-28 -0.2235 -0.1556
fixed NA count_birth_order2/2 -0.05705 0.04918 -1.16 11911 0.246 -0.1534 0.03933
fixed NA count_birth_order1/3 -0.1249 0.04595 -2.718 13109 0.006575 -0.215 -0.03484
fixed NA count_birth_order2/3 0.0004879 0.05123 0.009525 13120 0.9924 -0.09991 0.1009
fixed NA count_birth_order3/3 0.06406 0.05765 1.111 13131 0.2665 -0.04893 0.1771
fixed NA count_birth_order1/4 0.03162 0.05249 0.6024 13122 0.547 -0.07126 0.1345
fixed NA count_birth_order2/4 -0.04005 0.05544 -0.7225 13125 0.47 -0.1487 0.0686
fixed NA count_birth_order3/4 -0.1284 0.06086 -2.109 13132 0.03494 -0.2476 -0.009089
fixed NA count_birth_order4/4 -0.001447 0.06385 -0.02266 13134 0.9819 -0.1266 0.1237
fixed NA count_birth_order1/5 -0.1393 0.05994 -2.324 13132 0.02014 -0.2568 -0.02183
fixed NA count_birth_order2/5 -0.06536 0.06223 -1.05 13134 0.2936 -0.1873 0.05661
fixed NA count_birth_order3/5 0.00197 0.06385 0.03086 13135 0.9754 -0.1232 0.1271
fixed NA count_birth_order4/5 -0.05504 0.06836 -0.8053 13136 0.4207 -0.189 0.07893
fixed NA count_birth_order5/5 0.03196 0.06921 0.4618 13136 0.6442 -0.1037 0.1676
fixed NA count_birth_order1/>5 -0.08178 0.04827 -1.694 13134 0.09023 -0.1764 0.01282
fixed NA count_birth_order2/>5 -0.05255 0.04983 -1.055 13136 0.2917 -0.1502 0.04512
fixed NA count_birth_order3/>5 -0.04667 0.04888 -0.9549 13136 0.3396 -0.1425 0.04912
fixed NA count_birth_order4/>5 -0.06846 0.04795 -1.428 13136 0.1534 -0.1624 0.02552
fixed NA count_birth_order5/>5 -0.09239 0.04793 -1.928 13136 0.0539 -0.1863 0.00154
fixed NA count_birth_order>5/>5 -0.05918 0.03721 -1.591 12080 0.1117 -0.1321 0.01374
ran_pars mother_pidlink sd__(Intercept) 0.2169 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9685 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 37149 37232 -18564 37127 NA NA NA
12 37151 37241 -18564 37127 0.1115 1 0.7384
16 37157 37277 -18562 37125 2.188 4 0.7013
26 37153 37348 -18550 37101 23.98 10 0.007645

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.049 0.4283 2.45 5592 0.01433 0.2097 1.888
fixed NA poly(age, 3, raw = TRUE)1 -0.0891 0.04851 -1.837 5584 0.06632 -0.1842 0.005985
fixed NA poly(age, 3, raw = TRUE)2 0.002848 0.001728 1.648 5571 0.09949 -0.0005399 0.006235
fixed NA poly(age, 3, raw = TRUE)3 -0.0000287 0.00001954 -1.469 5551 0.1419 -0.00006699 0.000009593
fixed NA male -0.2247 0.02515 -8.938 5596 5.295e-19 -0.274 -0.1755
fixed NA sibling_count3 -0.07825 0.03816 -2.051 4405 0.04037 -0.153 -0.003456
fixed NA sibling_count4 -0.02742 0.04083 -0.6716 3811 0.5019 -0.1074 0.0526
fixed NA sibling_count5 -0.05557 0.04624 -1.202 3280 0.2295 -0.1462 0.03506
fixed NA sibling_count>5 -0.01853 0.04043 -0.4583 2939 0.6468 -0.09776 0.06071
ran_pars mother_pidlink sd__(Intercept) 0.1238 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9313 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.052 0.4284 2.455 5591 0.01413 0.2119 1.891
fixed NA birth_order -0.00229 0.008256 -0.2774 5083 0.7815 -0.01847 0.01389
fixed NA poly(age, 3, raw = TRUE)1 -0.08908 0.04852 -1.836 5583 0.0664 -0.1842 0.006012
fixed NA poly(age, 3, raw = TRUE)2 0.002851 0.001729 1.649 5570 0.09911 -0.0005368 0.006239
fixed NA poly(age, 3, raw = TRUE)3 -0.00002882 0.00001954 -1.475 5550 0.1403 -0.00006713 0.000009482
fixed NA male -0.2247 0.02515 -8.934 5595 5.493e-19 -0.274 -0.1754
fixed NA sibling_count3 -0.07714 0.03837 -2.011 4401 0.04443 -0.1523 -0.001941
fixed NA sibling_count4 -0.02485 0.04188 -0.5933 3796 0.553 -0.1069 0.05723
fixed NA sibling_count5 -0.05135 0.04868 -1.055 3318 0.2916 -0.1468 0.04407
fixed NA sibling_count>5 -0.01003 0.05071 -0.1979 3400 0.8431 -0.1094 0.08936
ran_pars mother_pidlink sd__(Intercept) 0.1234 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9315 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.026 0.429 2.391 5586 0.01685 0.1848 1.866
fixed NA poly(age, 3, raw = TRUE)1 -0.08819 0.04855 -1.816 5578 0.06936 -0.1833 0.006968
fixed NA poly(age, 3, raw = TRUE)2 0.002811 0.00173 1.625 5564 0.1042 -0.0005792 0.006202
fixed NA poly(age, 3, raw = TRUE)3 -0.00002829 0.00001956 -1.446 5544 0.1482 -0.00006663 0.00001005
fixed NA male -0.2244 0.02515 -8.92 5591 6.231e-19 -0.2737 -0.1751
fixed NA sibling_count3 -0.08624 0.03928 -2.196 4582 0.02817 -0.1632 -0.009255
fixed NA sibling_count4 -0.03939 0.04378 -0.8997 4151 0.3683 -0.1252 0.04641
fixed NA sibling_count5 -0.05825 0.05154 -1.13 3794 0.2585 -0.1593 0.04278
fixed NA sibling_count>5 -0.0163 0.0524 -0.311 3709 0.7558 -0.119 0.08641
fixed NA birth_order_nonlinear2 0.04954 0.03309 1.497 4885 0.1344 -0.01531 0.1144
fixed NA birth_order_nonlinear3 0.03766 0.04077 0.9236 5141 0.3557 -0.04225 0.1176
fixed NA birth_order_nonlinear4 0.03502 0.05007 0.6993 5284 0.4844 -0.06313 0.1332
fixed NA birth_order_nonlinear5 -0.02212 0.06288 -0.3517 5282 0.7251 -0.1454 0.1011
fixed NA birth_order_nonlinear>5 0.01008 0.06199 0.1626 5498 0.8709 -0.1114 0.1316
ran_pars mother_pidlink sd__(Intercept) 0.1225 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9316 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9659 0.4297 2.248 5576 0.02463 0.1237 1.808
fixed NA poly(age, 3, raw = TRUE)1 -0.08106 0.04864 -1.667 5569 0.09563 -0.1764 0.01426
fixed NA poly(age, 3, raw = TRUE)2 0.002578 0.001733 1.487 5555 0.137 -0.000819 0.005975
fixed NA poly(age, 3, raw = TRUE)3 -0.00002589 0.0000196 -1.321 5535 0.1866 -0.00006431 0.00001253
fixed NA male -0.2227 0.02516 -8.853 5581 1.127e-18 -0.2721 -0.1734
fixed NA count_birth_order2/2 0.02637 0.05933 0.4445 4955 0.6567 -0.08992 0.1427
fixed NA count_birth_order1/3 -0.1491 0.05167 -2.885 5580 0.003932 -0.2503 -0.04779
fixed NA count_birth_order2/3 -0.006833 0.05633 -0.1213 5581 0.9035 -0.1172 0.1036
fixed NA count_birth_order3/3 -0.005061 0.06322 -0.08006 5581 0.9362 -0.129 0.1189
fixed NA count_birth_order1/4 0.007126 0.06334 0.1125 5579 0.9104 -0.117 0.1313
fixed NA count_birth_order2/4 -0.03101 0.06571 -0.4719 5581 0.637 -0.1598 0.09778
fixed NA count_birth_order3/4 -0.07549 0.06934 -1.089 5580 0.2763 -0.2114 0.06041
fixed NA count_birth_order4/4 0.02371 0.07167 0.3308 5580 0.7408 -0.1168 0.1642
fixed NA count_birth_order1/5 0.0343 0.08707 0.3939 5581 0.6936 -0.1363 0.2049
fixed NA count_birth_order2/5 -0.1382 0.0915 -1.511 5581 0.1309 -0.3176 0.0411
fixed NA count_birth_order3/5 0.06142 0.08583 0.7156 5580 0.4743 -0.1068 0.2297
fixed NA count_birth_order4/5 -0.08468 0.08257 -1.025 5580 0.3052 -0.2465 0.07716
fixed NA count_birth_order5/5 -0.1152 0.08712 -1.322 5578 0.1861 -0.2859 0.05555
fixed NA count_birth_order1/>5 -0.05294 0.08612 -0.6147 5566 0.5388 -0.2217 0.1159
fixed NA count_birth_order2/>5 0.1103 0.08418 1.31 5572 0.1902 -0.0547 0.2753
fixed NA count_birth_order3/>5 -0.07246 0.08492 -0.8532 5580 0.3936 -0.2389 0.09399
fixed NA count_birth_order4/>5 0.01143 0.07976 0.1433 5581 0.8861 -0.1449 0.1678
fixed NA count_birth_order5/>5 -0.02858 0.07532 -0.3794 5581 0.7044 -0.1762 0.119
fixed NA count_birth_order>5/>5 -0.01489 0.05589 -0.2664 4859 0.7899 -0.1244 0.09465
ran_pars mother_pidlink sd__(Intercept) 0.1247 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9309 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15219 15292 -7598 15197 NA NA NA
12 15221 15300 -7598 15197 0.07815 1 0.7798
16 15226 15332 -7597 15194 3.215 4 0.5226
26 15230 15403 -7589 15178 15.45 10 0.1164

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.028 0.4272 2.407 5644 0.01612 0.1909 1.866
fixed NA poly(age, 3, raw = TRUE)1 -0.08594 0.04842 -1.775 5635 0.07593 -0.1808 0.008949
fixed NA poly(age, 3, raw = TRUE)2 0.00276 0.001725 1.6 5621 0.1098 -0.0006219 0.006141
fixed NA poly(age, 3, raw = TRUE)3 -0.00002778 0.00001951 -1.424 5600 0.1544 -0.00006601 0.00001045
fixed NA male -0.2282 0.02506 -9.107 5648 1.154e-19 -0.2773 -0.1791
fixed NA sibling_count3 -0.09326 0.04133 -2.256 4563 0.0241 -0.1743 -0.01225
fixed NA sibling_count4 -0.05237 0.04336 -1.208 4110 0.2272 -0.1374 0.03261
fixed NA sibling_count5 -0.05936 0.04608 -1.288 3599 0.1978 -0.1497 0.03096
fixed NA sibling_count>5 -0.04957 0.04042 -1.226 3618 0.2201 -0.1288 0.02965
ran_pars mother_pidlink sd__(Intercept) 0.1245 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9322 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.03 0.4274 2.41 5642 0.016 0.1922 1.867
fixed NA birth_order -0.00116 0.007178 -0.1616 4714 0.8716 -0.01523 0.01291
fixed NA poly(age, 3, raw = TRUE)1 -0.08597 0.04842 -1.775 5634 0.07587 -0.1809 0.008932
fixed NA poly(age, 3, raw = TRUE)2 0.002763 0.001726 1.601 5620 0.1094 -0.0006194 0.006145
fixed NA poly(age, 3, raw = TRUE)3 -0.00002786 0.00001951 -1.428 5598 0.1534 -0.0000661 0.00001039
fixed NA male -0.2282 0.02506 -9.105 5647 1.174e-19 -0.2773 -0.1791
fixed NA sibling_count3 -0.0927 0.04148 -2.235 4555 0.02546 -0.174 -0.01141
fixed NA sibling_count4 -0.05113 0.04404 -1.161 4077 0.2456 -0.1374 0.03518
fixed NA sibling_count5 -0.0574 0.04767 -1.204 3578 0.2286 -0.1508 0.03603
fixed NA sibling_count>5 -0.04536 0.04809 -0.9432 3823 0.3456 -0.1396 0.0489
ran_pars mother_pidlink sd__(Intercept) 0.1245 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9322 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.002 0.4279 2.342 5637 0.01922 0.1635 1.841
fixed NA poly(age, 3, raw = TRUE)1 -0.08492 0.04844 -1.753 5629 0.07965 -0.1799 0.01002
fixed NA poly(age, 3, raw = TRUE)2 0.002714 0.001726 1.572 5615 0.116 -0.0006696 0.006098
fixed NA poly(age, 3, raw = TRUE)3 -0.00002717 0.00001952 -1.391 5593 0.1641 -0.00006544 0.0000111
fixed NA male -0.228 0.02506 -9.096 5643 1.274e-19 -0.2771 -0.1789
fixed NA sibling_count3 -0.1039 0.04233 -2.456 4702 0.0141 -0.1869 -0.02098
fixed NA sibling_count4 -0.06911 0.04576 -1.51 4366 0.131 -0.1588 0.02058
fixed NA sibling_count5 -0.0629 0.05026 -1.251 4013 0.2108 -0.1614 0.03561
fixed NA sibling_count>5 -0.05826 0.04978 -1.17 4167 0.2419 -0.1558 0.03931
fixed NA birth_order_nonlinear2 0.05573 0.03362 1.657 5001 0.0975 -0.01017 0.1216
fixed NA birth_order_nonlinear3 0.04984 0.04063 1.227 5251 0.2201 -0.0298 0.1295
fixed NA birth_order_nonlinear4 0.04656 0.04858 0.9584 5395 0.3379 -0.04865 0.1418
fixed NA birth_order_nonlinear5 -0.03878 0.05997 -0.6466 5413 0.5179 -0.1563 0.07877
fixed NA birth_order_nonlinear>5 0.0368 0.05516 0.667 5458 0.5048 -0.07132 0.1449
ran_pars mother_pidlink sd__(Intercept) 0.1244 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9322 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9712 0.4283 2.267 5626 0.0234 0.1317 1.811
fixed NA poly(age, 3, raw = TRUE)1 -0.0814 0.04848 -1.679 5618 0.09319 -0.1764 0.01361
fixed NA poly(age, 3, raw = TRUE)2 0.002602 0.001728 1.506 5603 0.1321 -0.0007843 0.005989
fixed NA poly(age, 3, raw = TRUE)3 -0.00002605 0.00001954 -1.333 5581 0.1826 -0.00006436 0.00001226
fixed NA male -0.2291 0.02507 -9.14 5633 8.554e-20 -0.2782 -0.18
fixed NA count_birth_order2/2 0.04849 0.06493 0.7467 5044 0.4553 -0.07878 0.1758
fixed NA count_birth_order1/3 -0.1679 0.05589 -3.005 5632 0.002671 -0.2775 -0.05838
fixed NA count_birth_order2/3 -0.02805 0.06057 -0.4631 5633 0.6433 -0.1468 0.09067
fixed NA count_birth_order3/3 0.0296 0.06842 0.4325 5633 0.6654 -0.1045 0.1637
fixed NA count_birth_order1/4 -0.005126 0.06627 -0.07735 5632 0.9383 -0.135 0.1248
fixed NA count_birth_order2/4 -0.04986 0.06714 -0.7426 5633 0.4578 -0.1814 0.08173
fixed NA count_birth_order3/4 -0.1197 0.07463 -1.605 5632 0.1086 -0.266 0.02652
fixed NA count_birth_order4/4 0.02688 0.07657 0.3511 5632 0.7256 -0.1232 0.177
fixed NA count_birth_order1/5 -0.0005703 0.07891 -0.007228 5632 0.9942 -0.1552 0.1541
fixed NA count_birth_order2/5 -0.06387 0.08439 -0.7568 5633 0.4492 -0.2293 0.1015
fixed NA count_birth_order3/5 0.05279 0.08275 0.6379 5633 0.5236 -0.1094 0.215
fixed NA count_birth_order4/5 -0.1065 0.08431 -1.264 5632 0.2064 -0.2718 0.0587
fixed NA count_birth_order5/5 -0.1147 0.08589 -1.335 5630 0.1818 -0.283 0.05365
fixed NA count_birth_order1/>5 -0.06879 0.07534 -0.9131 5623 0.3613 -0.2164 0.07887
fixed NA count_birth_order2/>5 0.04887 0.07825 0.6245 5628 0.5323 -0.1045 0.2022
fixed NA count_birth_order3/>5 -0.07751 0.07663 -1.011 5633 0.3119 -0.2277 0.07269
fixed NA count_birth_order4/>5 -0.0007247 0.07385 -0.009813 5633 0.9922 -0.1455 0.144
fixed NA count_birth_order5/>5 -0.09299 0.07634 -1.218 5632 0.2232 -0.2426 0.05664
fixed NA count_birth_order>5/>5 -0.02458 0.0547 -0.4494 5065 0.6532 -0.1318 0.08263
ran_pars mother_pidlink sd__(Intercept) 0.1213 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9321 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 15371 15444 -7675 15349 NA NA NA
12 15373 15453 -7675 15349 0.02676 1 0.8701
16 15376 15482 -7672 15344 5.218 4 0.2657
26 15381 15553 -7664 15329 15.32 10 0.1209

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9132 0.4324 2.112 5480 0.03473 0.06576 1.761
fixed NA poly(age, 3, raw = TRUE)1 -0.07301 0.049 -1.49 5472 0.1363 -0.1691 0.02304
fixed NA poly(age, 3, raw = TRUE)2 0.002181 0.001747 1.249 5459 0.2119 -0.001243 0.005604
fixed NA poly(age, 3, raw = TRUE)3 -0.00002022 0.00001976 -1.023 5440 0.3062 -0.00005894 0.0000185
fixed NA male -0.2238 0.02536 -8.828 5483 1.413e-18 -0.2735 -0.1741
fixed NA sibling_count3 -0.04656 0.03761 -1.238 4289 0.2158 -0.1203 0.02716
fixed NA sibling_count4 -0.01363 0.04054 -0.3363 3717 0.7367 -0.09309 0.06582
fixed NA sibling_count5 0.001808 0.04729 0.03824 3067 0.9695 -0.09087 0.09449
fixed NA sibling_count>5 -0.01265 0.04078 -0.3103 2754 0.7564 -0.09257 0.06727
ran_pars mother_pidlink sd__(Intercept) 0.1348 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9277 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9127 0.4325 2.111 5479 0.03486 0.06512 1.76
fixed NA birth_order 0.000456 0.008519 0.05353 5095 0.9573 -0.01624 0.01715
fixed NA poly(age, 3, raw = TRUE)1 -0.07302 0.04901 -1.49 5471 0.1363 -0.1691 0.02304
fixed NA poly(age, 3, raw = TRUE)2 0.00218 0.001747 1.248 5458 0.212 -0.001243 0.005604
fixed NA poly(age, 3, raw = TRUE)3 -0.00002019 0.00001976 -1.022 5439 0.3069 -0.00005893 0.00001854
fixed NA male -0.2238 0.02536 -8.827 5482 1.422e-18 -0.2735 -0.1741
fixed NA sibling_count3 -0.04678 0.03784 -1.236 4284 0.2164 -0.1209 0.02738
fixed NA sibling_count4 -0.01414 0.04163 -0.3396 3716 0.7342 -0.09574 0.06746
fixed NA sibling_count5 0.001006 0.04962 0.02027 3118 0.9838 -0.09624 0.09825
fixed NA sibling_count>5 -0.01433 0.05143 -0.2786 3317 0.7806 -0.1151 0.08647
ran_pars mother_pidlink sd__(Intercept) 0.1351 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9278 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.8882 0.433 2.051 5473 0.04029 0.03954 1.737
fixed NA poly(age, 3, raw = TRUE)1 -0.07193 0.04904 -1.467 5466 0.1425 -0.168 0.02418
fixed NA poly(age, 3, raw = TRUE)2 0.002137 0.001748 1.222 5453 0.2216 -0.001289 0.005562
fixed NA poly(age, 3, raw = TRUE)3 -0.00001967 0.00001978 -0.9946 5434 0.32 -0.00005843 0.00001909
fixed NA male -0.2233 0.02537 -8.805 5478 1.733e-18 -0.2731 -0.1736
fixed NA sibling_count3 -0.0543 0.03876 -1.401 4466 0.1613 -0.1303 0.02167
fixed NA sibling_count4 -0.02342 0.04356 -0.5376 4064 0.5909 -0.1088 0.06196
fixed NA sibling_count5 -0.001756 0.05226 -0.0336 3536 0.9732 -0.1042 0.1007
fixed NA sibling_count>5 -0.016 0.05321 -0.3006 3640 0.7637 -0.1203 0.0883
fixed NA birth_order_nonlinear2 0.04845 0.03294 1.471 4775 0.1414 -0.01611 0.113
fixed NA birth_order_nonlinear3 0.03917 0.04067 0.9632 5008 0.3355 -0.04053 0.1189
fixed NA birth_order_nonlinear4 0.02205 0.05151 0.428 5165 0.6687 -0.07892 0.123
fixed NA birth_order_nonlinear5 -0.004136 0.06549 -0.06317 5179 0.9496 -0.1325 0.1242
fixed NA birth_order_nonlinear>5 0.02085 0.06395 0.3261 5437 0.7444 -0.1045 0.1462
ran_pars mother_pidlink sd__(Intercept) 0.1348 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9279 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.831 0.4338 1.915 5463 0.0555 -0.01936 1.681
fixed NA poly(age, 3, raw = TRUE)1 -0.06428 0.04913 -1.308 5456 0.1909 -0.1606 0.03203
fixed NA poly(age, 3, raw = TRUE)2 0.001883 0.001752 1.075 5443 0.2825 -0.00155 0.005316
fixed NA poly(age, 3, raw = TRUE)3 -0.00001703 0.00001982 -0.8592 5423 0.3903 -0.00005588 0.00002182
fixed NA male -0.2212 0.02538 -8.718 5468 3.705e-18 -0.271 -0.1715
fixed NA count_birth_order2/2 0.005957 0.0577 0.1032 4832 0.9178 -0.1071 0.119
fixed NA count_birth_order1/3 -0.1323 0.0509 -2.599 5466 0.009377 -0.232 -0.03252
fixed NA count_birth_order2/3 0.01953 0.0563 0.3468 5468 0.7287 -0.09081 0.1299
fixed NA count_birth_order3/3 0.03569 0.06196 0.576 5467 0.5646 -0.08575 0.1571
fixed NA count_birth_order1/4 0.02198 0.06356 0.3458 5466 0.7295 -0.1026 0.1465
fixed NA count_birth_order2/4 -0.01268 0.06554 -0.1935 5468 0.8466 -0.1411 0.1158
fixed NA count_birth_order3/4 -0.0643 0.06839 -0.9402 5467 0.3472 -0.1984 0.06975
fixed NA count_birth_order4/4 0.001813 0.07231 0.02506 5466 0.98 -0.1399 0.1435
fixed NA count_birth_order1/5 0.08837 0.08671 1.019 5467 0.3082 -0.08157 0.2583
fixed NA count_birth_order2/5 -0.07422 0.0942 -0.7878 5468 0.4308 -0.2588 0.1104
fixed NA count_birth_order3/5 0.06378 0.08976 0.7106 5467 0.4774 -0.1121 0.2397
fixed NA count_birth_order4/5 -0.01829 0.08662 -0.2112 5467 0.8327 -0.1881 0.1515
fixed NA count_birth_order5/5 -0.06024 0.09297 -0.6479 5465 0.5171 -0.2425 0.122
fixed NA count_birth_order1/>5 -0.07076 0.08852 -0.7993 5458 0.4241 -0.2443 0.1027
fixed NA count_birth_order2/>5 0.09919 0.08581 1.156 5461 0.2478 -0.069 0.2674
fixed NA count_birth_order3/>5 -0.06262 0.08586 -0.7294 5468 0.4658 -0.2309 0.1056
fixed NA count_birth_order4/>5 -0.01431 0.08371 -0.1709 5468 0.8643 -0.1784 0.1498
fixed NA count_birth_order5/>5 -0.01093 0.07712 -0.1418 5468 0.8872 -0.1621 0.1402
fixed NA count_birth_order>5/>5 -0.01065 0.05681 -0.1875 4727 0.8513 -0.122 0.1007
ran_pars mother_pidlink sd__(Intercept) 0.1365 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9273 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 14888 14961 -7433 14866 NA NA NA
12 14890 14970 -7433 14866 0.002696 1 0.9586
16 14896 15001 -7432 14864 2.661 4 0.6161
26 14901 15073 -7424 14849 14.83 10 0.1385

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Educational Attainment

Years of Education - z-standardized

birthorder <- birthorder %>% mutate(outcome = years_of_education_z)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.688 0.1288 -20.87 13921 2.79e-95 -2.941 -2.436
fixed NA poly(age, 3, raw = TRUE)1 0.2633 0.01224 21.51 13740 5.722e-101 0.2393 0.2873
fixed NA poly(age, 3, raw = TRUE)2 -0.006974 0.0003591 -19.42 13831 6.417e-83 -0.007678 -0.00627
fixed NA poly(age, 3, raw = TRUE)3 0.00005177 0.000003294 15.71 13961 3.555e-55 0.00004531 0.00005823
fixed NA male -0.02813 0.013 -2.163 11845 0.03054 -0.05362 -0.002644
fixed NA sibling_count3 0.07051 0.03368 2.093 8872 0.03634 0.004496 0.1365
fixed NA sibling_count4 0.0338 0.03529 0.9576 8520 0.3383 -0.03538 0.103
fixed NA sibling_count5 0.02754 0.0374 0.7364 8186 0.4615 -0.04577 0.1008
fixed NA sibling_count>5 -0.2199 0.02876 -7.648 8601 2.267e-14 -0.2763 -0.1636
ran_pars mother_pidlink sd__(Intercept) 0.6782 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6413 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.696 0.1288 -20.93 13940 8.407e-96 -2.949 -2.444
fixed NA birth_order 0.006501 0.002997 2.169 14329 0.03007 0.0006277 0.01237
fixed NA poly(age, 3, raw = TRUE)1 0.2614 0.01227 21.3 13729 4.864e-99 0.2373 0.2854
fixed NA poly(age, 3, raw = TRUE)2 -0.006884 0.0003615 -19.04 13901 7.772e-80 -0.007592 -0.006175
fixed NA poly(age, 3, raw = TRUE)3 0.00005089 0.00000332 15.33 14047 1.298e-52 0.00004438 0.00005739
fixed NA male -0.0283 0.013 -2.177 11831 0.02948 -0.05378 -0.002824
fixed NA sibling_count3 0.07026 0.0337 2.085 8864 0.03708 0.004219 0.1363
fixed NA sibling_count4 0.0308 0.03534 0.8716 8552 0.3835 -0.03846 0.1001
fixed NA sibling_count5 0.02083 0.03755 0.5546 8274 0.5792 -0.05277 0.09442
fixed NA sibling_count>5 -0.2435 0.03076 -7.917 9687 2.696e-15 -0.3038 -0.1832
ran_pars mother_pidlink sd__(Intercept) 0.6792 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6407 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.665 0.1291 -20.64 13948 3.079e-93 -2.918 -2.411
fixed NA poly(age, 3, raw = TRUE)1 0.2613 0.01227 21.31 13731 3.994e-99 0.2373 0.2854
fixed NA poly(age, 3, raw = TRUE)2 -0.006871 0.0003613 -19.02 13893 1.177e-79 -0.007579 -0.006163
fixed NA poly(age, 3, raw = TRUE)3 0.00005046 0.000003321 15.2 14054 9.485e-52 0.00004396 0.00005697
fixed NA male -0.02841 0.01299 -2.188 11817 0.02869 -0.05386 -0.002961
fixed NA sibling_count3 0.08287 0.03392 2.443 9053 0.01458 0.01639 0.1494
fixed NA sibling_count4 0.05735 0.0358 1.602 8918 0.1092 -0.01282 0.1275
fixed NA sibling_count5 0.05175 0.03825 1.353 8753 0.1761 -0.02322 0.1267
fixed NA sibling_count>5 -0.2166 0.03162 -6.85 10296 7.805e-12 -0.2786 -0.1546
fixed NA birth_order_nonlinear2 -0.04969 0.01841 -2.698 11706 0.006979 -0.08578 -0.0136
fixed NA birth_order_nonlinear3 -0.07061 0.02142 -3.296 11239 0.000984 -0.1126 -0.02862
fixed NA birth_order_nonlinear4 -0.08076 0.02452 -3.293 11322 0.0009945 -0.1288 -0.03269
fixed NA birth_order_nonlinear5 -0.02921 0.02787 -1.048 11274 0.2946 -0.08383 0.02541
fixed NA birth_order_nonlinear>5 0.0102 0.02471 0.4128 13717 0.6797 -0.03823 0.05863
ran_pars mother_pidlink sd__(Intercept) 0.6799 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6398 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.655 0.1297 -20.47 13969 8.124e-92 -2.909 -2.401
fixed NA poly(age, 3, raw = TRUE)1 0.261 0.01227 21.27 13739 8.457e-99 0.237 0.2851
fixed NA poly(age, 3, raw = TRUE)2 -0.006856 0.0003615 -18.96 13907 3.426e-79 -0.007565 -0.006147
fixed NA poly(age, 3, raw = TRUE)3 0.00005029 0.000003325 15.12 14075 2.806e-51 0.00004377 0.00005681
fixed NA male -0.02811 0.01299 -2.165 11808 0.03043 -0.05357 -0.002659
fixed NA count_birth_order2/2 -0.07379 0.03615 -2.041 12452 0.04125 -0.1446 -0.002938
fixed NA count_birth_order1/3 0.07773 0.03991 1.948 12462 0.05148 -0.0004907 0.156
fixed NA count_birth_order2/3 0.01959 0.04385 0.4469 13398 0.655 -0.06635 0.1055
fixed NA count_birth_order3/3 0.004158 0.04807 0.08651 14043 0.9311 -0.09005 0.09837
fixed NA count_birth_order1/4 0.03963 0.04447 0.8911 13169 0.3729 -0.04753 0.1268
fixed NA count_birth_order2/4 -0.01847 0.04706 -0.3925 13682 0.6947 -0.1107 0.07377
fixed NA count_birth_order3/4 -0.003081 0.0501 -0.0615 14157 0.951 -0.1013 0.09511
fixed NA count_birth_order4/4 -0.006753 0.05219 -0.1294 14271 0.8971 -0.109 0.09554
fixed NA count_birth_order1/5 0.03106 0.05016 0.6191 13791 0.5359 -0.06726 0.1294
fixed NA count_birth_order2/5 0.004568 0.05248 0.08705 14111 0.9306 -0.09828 0.1074
fixed NA count_birth_order3/5 -0.09389 0.05304 -1.77 14194 0.07675 -0.1978 0.01008
fixed NA count_birth_order4/5 -0.04342 0.05613 -0.7736 14397 0.4392 -0.1534 0.06658
fixed NA count_birth_order5/5 0.1147 0.0571 2.008 14418 0.04461 0.00277 0.2266
fixed NA count_birth_order1/>5 -0.2286 0.0397 -5.758 14136 0.000000008705 -0.3064 -0.1508
fixed NA count_birth_order2/>5 -0.2492 0.04077 -6.112 14318 0.000000001011 -0.3291 -0.1693
fixed NA count_birth_order3/>5 -0.2759 0.03996 -6.904 14268 5.255e-12 -0.3542 -0.1976
fixed NA count_birth_order4/>5 -0.3126 0.03947 -7.919 14200 2.578e-15 -0.3899 -0.2352
fixed NA count_birth_order5/>5 -0.2873 0.03954 -7.266 14231 3.898e-13 -0.3648 -0.2098
fixed NA count_birth_order>5/>5 -0.2149 0.03384 -6.349 11606 0.0000000002245 -0.2812 -0.1485
ran_pars mother_pidlink sd__(Intercept) 0.6799 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.6397 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 36298 36381 -18138 36276 NA NA NA
12 36295 36386 -18136 36271 4.685 1 0.03043
16 36281 36402 -18125 36249 22.33 4 0.0001724
26 36288 36485 -18118 36236 13.46 10 0.1991

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -6.736 0.309 -21.8 5587 3.473e-101 -7.342 -6.13
fixed NA poly(age, 3, raw = TRUE)1 0.7187 0.03506 20.5 5537 4.764e-90 0.65 0.7874
fixed NA poly(age, 3, raw = TRUE)2 -0.02238 0.001252 -17.87 5503 1.784e-69 -0.02483 -0.01993
fixed NA poly(age, 3, raw = TRUE)3 0.0002241 0.0000142 15.78 5486 6.934e-55 0.0001963 0.000252
fixed NA male -0.07737 0.0178 -4.347 5339 0.00001407 -0.1123 -0.04248
fixed NA sibling_count3 0.01365 0.03226 0.423 4384 0.6723 -0.04959 0.07688
fixed NA sibling_count4 -0.08132 0.03529 -2.304 4151 0.02126 -0.1505 -0.01215
fixed NA sibling_count5 -0.1649 0.04105 -4.017 4003 0.0000599 -0.2454 -0.08447
fixed NA sibling_count>5 -0.3901 0.03602 -10.83 3979 5.93e-27 -0.4607 -0.3195
ran_pars mother_pidlink sd__(Intercept) 0.5155 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.5677 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -6.749 0.3088 -21.86 5584 1.094e-101 -7.354 -6.144
fixed NA birth_order 0.01624 0.006102 2.662 5956 0.007783 0.004285 0.0282
fixed NA poly(age, 3, raw = TRUE)1 0.7172 0.03504 20.47 5534 8.325e-90 0.6485 0.7858
fixed NA poly(age, 3, raw = TRUE)2 -0.02234 0.001251 -17.85 5501 2.566e-69 -0.02479 -0.01988
fixed NA poly(age, 3, raw = TRUE)3 0.0002243 0.00001419 15.81 5480 4.538e-55 0.0001965 0.0002522
fixed NA male -0.07822 0.01779 -4.398 5334 0.00001114 -0.1131 -0.04336
fixed NA sibling_count3 0.004941 0.03243 0.1524 4398 0.8789 -0.05863 0.06851
fixed NA sibling_count4 -0.1021 0.03616 -2.824 4189 0.004758 -0.173 -0.03126
fixed NA sibling_count5 -0.198 0.04291 -4.615 4127 0.000004046 -0.2821 -0.1139
fixed NA sibling_count>5 -0.4559 0.04371 -10.43 4521 3.489e-25 -0.5415 -0.3702
ran_pars mother_pidlink sd__(Intercept) 0.5166 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.5667 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -6.665 0.3096 -21.53 5634 7.32e-99 -7.271 -6.058
fixed NA poly(age, 3, raw = TRUE)1 0.712 0.03506 20.31 5568 1.623e-88 0.6433 0.7808
fixed NA poly(age, 3, raw = TRUE)2 -0.02217 0.001252 -17.71 5526 2.665e-68 -0.02462 -0.01971
fixed NA poly(age, 3, raw = TRUE)3 0.0002228 0.00001419 15.69 5497 2.469e-54 0.0001949 0.0002506
fixed NA male -0.07857 0.01776 -4.425 5329 0.000009827 -0.1134 -0.04377
fixed NA sibling_count3 0.005269 0.03283 0.1605 4535 0.8725 -0.05908 0.06962
fixed NA sibling_count4 -0.1132 0.03708 -3.054 4416 0.002272 -0.1859 -0.04056
fixed NA sibling_count5 -0.2355 0.04429 -5.317 4415 0.0000001104 -0.3223 -0.1487
fixed NA sibling_count>5 -0.4792 0.04459 -10.74 4663 1.282e-26 -0.5666 -0.3918
fixed NA birth_order_nonlinear2 -0.05353 0.02201 -2.433 4629 0.01503 -0.09667 -0.0104
fixed NA birth_order_nonlinear3 0.02796 0.02736 1.022 4813 0.307 -0.02568 0.08159
fixed NA birth_order_nonlinear4 0.0843 0.03424 2.462 5002 0.01385 0.01719 0.1514
fixed NA birth_order_nonlinear5 0.1608 0.04246 3.786 4749 0.0001547 0.07755 0.244
fixed NA birth_order_nonlinear>5 0.07327 0.04454 1.645 5665 0.1 -0.01403 0.1606
ran_pars mother_pidlink sd__(Intercept) 0.5157 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.5657 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -6.676 0.3105 -21.5 5642 1.325e-98 -7.285 -6.067
fixed NA poly(age, 3, raw = TRUE)1 0.713 0.03516 20.28 5568 2.752e-88 0.6441 0.7819
fixed NA poly(age, 3, raw = TRUE)2 -0.02222 0.001256 -17.69 5528 3.405e-68 -0.02468 -0.01976
fixed NA poly(age, 3, raw = TRUE)3 0.0002235 0.00001424 15.69 5502 2.59e-54 0.0001955 0.0002514
fixed NA male -0.07799 0.01778 -4.386 5320 0.00001175 -0.1128 -0.04314
fixed NA count_birth_order2/2 -0.03586 0.04032 -0.8893 5082 0.3739 -0.1149 0.04317
fixed NA count_birth_order1/3 0.03154 0.03934 0.8017 5865 0.4228 -0.04557 0.1087
fixed NA count_birth_order2/3 -0.06423 0.04233 -1.517 6060 0.1292 -0.1472 0.01873
fixed NA count_birth_order3/3 0.02724 0.04677 0.5824 6126 0.5603 -0.06443 0.1189
fixed NA count_birth_order1/4 -0.1151 0.0475 -2.423 6050 0.01543 -0.2082 -0.02198
fixed NA count_birth_order2/4 -0.1695 0.04852 -3.495 6118 0.0004782 -0.2646 -0.07446
fixed NA count_birth_order3/4 -0.0516 0.05091 -1.014 6126 0.3108 -0.1514 0.04818
fixed NA count_birth_order4/4 -0.03001 0.05286 -0.5676 6123 0.5703 -0.1336 0.0736
fixed NA count_birth_order1/5 -0.2277 0.06389 -3.564 6130 0.0003685 -0.3529 -0.1025
fixed NA count_birth_order2/5 -0.2326 0.06767 -3.437 6029 0.0005926 -0.3652 -0.09994
fixed NA count_birth_order3/5 -0.2085 0.06323 -3.297 6079 0.0009821 -0.3324 -0.08455
fixed NA count_birth_order4/5 -0.1802 0.06188 -2.912 6108 0.003603 -0.3015 -0.05892
fixed NA count_birth_order5/5 -0.06835 0.06392 -1.069 6073 0.285 -0.1936 0.05694
fixed NA count_birth_order1/>5 -0.5118 0.06239 -8.204 6045 2.818e-16 -0.6341 -0.3895
fixed NA count_birth_order2/>5 -0.5145 0.06185 -8.319 6010 1.09e-16 -0.6357 -0.3933
fixed NA count_birth_order3/>5 -0.4626 0.0607 -7.622 5958 2.895e-14 -0.5816 -0.3437
fixed NA count_birth_order4/>5 -0.351 0.05758 -6.095 5998 0.000000001159 -0.4638 -0.2381
fixed NA count_birth_order5/>5 -0.3139 0.05473 -5.734 6037 0.00000001026 -0.4211 -0.2066
fixed NA count_birth_order>5/>5 -0.3993 0.04395 -9.085 5818 1.393e-19 -0.4854 -0.3132
ran_pars mother_pidlink sd__(Intercept) 0.5154 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.5662 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 13603 13677 -6790 13581 NA NA NA
12 13598 13678 -6787 13574 7.074 1 0.007821
16 13581 13688 -6774 13549 24.75 4 0.00005645
26 13596 13771 -6772 13544 4.93 10 0.8958

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -6.746 0.3083 -21.88 5626 6.385e-102 -7.351 -6.142
fixed NA poly(age, 3, raw = TRUE)1 0.7193 0.035 20.55 5570 1.483e-90 0.6507 0.7879
fixed NA poly(age, 3, raw = TRUE)2 -0.02245 0.00125 -17.96 5534 3.827e-70 -0.0249 -0.02
fixed NA poly(age, 3, raw = TRUE)3 0.0002249 0.00001418 15.85 5516 2.161e-55 0.0001971 0.0002526
fixed NA male -0.07773 0.01774 -4.381 5374 0.00001204 -0.1125 -0.04296
fixed NA sibling_count3 0.0339 0.03494 0.9704 4519 0.3319 -0.03457 0.1024
fixed NA sibling_count4 -0.03127 0.03721 -0.8404 4323 0.4007 -0.1042 0.04166
fixed NA sibling_count5 -0.08928 0.04042 -2.209 4164 0.02724 -0.1685 -0.01006
fixed NA sibling_count>5 -0.2673 0.03522 -7.589 4304 3.939e-14 -0.3363 -0.1983
ran_pars mother_pidlink sd__(Intercept) 0.5206 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.5663 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -6.75 0.3084 -21.89 5623 5.425e-102 -7.354 -6.145
fixed NA birth_order 0.003115 0.005405 0.5763 6116 0.5644 -0.007478 0.01371
fixed NA poly(age, 3, raw = TRUE)1 0.7191 0.035 20.55 5567 1.658e-90 0.6505 0.7877
fixed NA poly(age, 3, raw = TRUE)2 -0.02245 0.00125 -17.96 5531 4.071e-70 -0.0249 -0.02
fixed NA poly(age, 3, raw = TRUE)3 0.0002249 0.00001418 15.86 5510 1.976e-55 0.0001971 0.0002527
fixed NA male -0.07789 0.01774 -4.39 5370 0.00001157 -0.1127 -0.04311
fixed NA sibling_count3 0.03222 0.03507 0.9189 4519 0.3582 -0.03651 0.101
fixed NA sibling_count4 -0.03509 0.0378 -0.9283 4329 0.3533 -0.1092 0.039
fixed NA sibling_count5 -0.09522 0.04172 -2.282 4209 0.02253 -0.177 -0.01344
fixed NA sibling_count>5 -0.2794 0.04103 -6.809 4662 0.00000000001107 -0.3598 -0.199
ran_pars mother_pidlink sd__(Intercept) 0.521 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.5661 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -6.671 0.3092 -21.57 5670 2.942e-99 -7.277 -6.065
fixed NA poly(age, 3, raw = TRUE)1 0.7127 0.03503 20.34 5600 7.838e-89 0.6441 0.7814
fixed NA poly(age, 3, raw = TRUE)2 -0.02222 0.001251 -17.76 5557 1.068e-68 -0.02467 -0.01977
fixed NA poly(age, 3, raw = TRUE)3 0.0002226 0.00001419 15.68 5529 2.803e-54 0.0001948 0.0002504
fixed NA male -0.07837 0.01773 -4.421 5366 0.00001003 -0.1131 -0.04362
fixed NA sibling_count3 0.03597 0.03548 1.014 4641 0.3107 -0.03356 0.1055
fixed NA sibling_count4 -0.03978 0.0387 -1.028 4536 0.304 -0.1156 0.03606
fixed NA sibling_count5 -0.1169 0.04304 -2.716 4476 0.006635 -0.2013 -0.03254
fixed NA sibling_count>5 -0.2918 0.04193 -6.96 4804 3.865e-12 -0.374 -0.2096
fixed NA birth_order_nonlinear2 -0.05895 0.02256 -2.613 4743 0.008999 -0.1032 -0.01474
fixed NA birth_order_nonlinear3 -0.01423 0.0274 -0.5195 4898 0.6034 -0.06793 0.03946
fixed NA birth_order_nonlinear4 0.03769 0.03338 1.129 5125 0.2589 -0.02773 0.1031
fixed NA birth_order_nonlinear5 0.0732 0.04067 1.8 4937 0.07195 -0.006512 0.1529
fixed NA birth_order_nonlinear>5 -0.01079 0.04033 -0.2675 5891 0.7891 -0.08984 0.06826
ran_pars mother_pidlink sd__(Intercept) 0.5208 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.5654 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -6.652 0.3102 -21.44 5684 3.797e-98 -7.26 -6.044
fixed NA poly(age, 3, raw = TRUE)1 0.7099 0.03512 20.22 5604 8.757e-88 0.6411 0.7788
fixed NA poly(age, 3, raw = TRUE)2 -0.02212 0.001255 -17.63 5564 9.955e-68 -0.02458 -0.01966
fixed NA poly(age, 3, raw = TRUE)3 0.0002213 0.00001423 15.55 5538 2.102e-53 0.0001934 0.0002492
fixed NA male -0.07904 0.01775 -4.453 5361 0.000008631 -0.1138 -0.04425
fixed NA count_birth_order2/2 -0.04672 0.0446 -1.048 5245 0.2949 -0.1341 0.04069
fixed NA count_birth_order1/3 0.05622 0.04275 1.315 5928 0.1886 -0.02757 0.14
fixed NA count_birth_order2/3 -0.05503 0.04603 -1.196 6113 0.2319 -0.1452 0.03518
fixed NA count_birth_order3/3 0.04289 0.05079 0.8444 6182 0.3985 -0.05666 0.1424
fixed NA count_birth_order1/4 -0.07165 0.04984 -1.438 6098 0.1506 -0.1693 0.02603
fixed NA count_birth_order2/4 -0.05084 0.05034 -1.01 6159 0.3125 -0.1495 0.04782
fixed NA count_birth_order3/4 -0.06351 0.0545 -1.165 6177 0.2439 -0.1703 0.0433
fixed NA count_birth_order4/4 0.009664 0.0564 0.1713 6178 0.864 -0.1009 0.1202
fixed NA count_birth_order1/5 -0.1223 0.05889 -2.077 6177 0.03787 -0.2377 -0.006873
fixed NA count_birth_order2/5 -0.1555 0.06209 -2.504 6151 0.0123 -0.2772 -0.03379
fixed NA count_birth_order3/5 -0.1429 0.06084 -2.349 6157 0.01888 -0.2621 -0.02364
fixed NA count_birth_order4/5 -0.09629 0.06301 -1.528 6126 0.1265 -0.2198 0.02721
fixed NA count_birth_order5/5 -0.007981 0.06277 -0.1271 6133 0.8988 -0.131 0.1151
fixed NA count_birth_order1/>5 -0.2597 0.05562 -4.669 6186 0.000003092 -0.3687 -0.1507
fixed NA count_birth_order2/>5 -0.3699 0.05726 -6.461 6112 0.0000000001124 -0.4822 -0.2577
fixed NA count_birth_order3/>5 -0.2976 0.05583 -5.33 6101 0.0000001018 -0.407 -0.1881
fixed NA count_birth_order4/>5 -0.2436 0.05381 -4.526 6131 0.000006113 -0.3491 -0.1381
fixed NA count_birth_order5/>5 -0.2379 0.05508 -4.318 6043 0.00001598 -0.3458 -0.1299
fixed NA count_birth_order>5/>5 -0.2999 0.04319 -6.943 5904 4.247e-12 -0.3845 -0.2152
ran_pars mother_pidlink sd__(Intercept) 0.52 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.5661 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 13753 13827 -6866 13731 NA NA NA
12 13755 13836 -6865 13731 0.3298 1 0.5658
16 13747 13855 -6857 13715 16.17 4 0.002799
26 13760 13935 -6854 13708 6.573 10 0.765

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -6.758 0.313 -21.59 5471 2.78e-99 -7.371 -6.144
fixed NA poly(age, 3, raw = TRUE)1 0.7212 0.03553 20.3 5420 2.406e-88 0.6516 0.7908
fixed NA poly(age, 3, raw = TRUE)2 -0.02248 0.001269 -17.72 5381 2.687e-68 -0.02497 -0.02
fixed NA poly(age, 3, raw = TRUE)3 0.0002253 0.0000144 15.65 5360 5.372e-54 0.0001971 0.0002536
fixed NA male -0.07967 0.018 -4.426 5233 0.000009789 -0.1149 -0.04439
fixed NA sibling_count3 0.007354 0.03188 0.2306 4375 0.8176 -0.05514 0.06985
fixed NA sibling_count4 -0.06524 0.03511 -1.858 4170 0.0632 -0.1341 0.00357
fixed NA sibling_count5 -0.1584 0.04224 -3.75 3939 0.000179 -0.2412 -0.07564
fixed NA sibling_count>5 -0.3751 0.03659 -10.25 3915 2.328e-24 -0.4469 -0.3034
ran_pars mother_pidlink sd__(Intercept) 0.5174 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.568 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -6.769 0.3128 -21.64 5468 1.04e-99 -7.382 -6.156
fixed NA birth_order 0.01578 0.006262 2.52 5789 0.01177 0.003506 0.02805
fixed NA poly(age, 3, raw = TRUE)1 0.7196 0.03551 20.26 5418 4.494e-88 0.65 0.7892
fixed NA poly(age, 3, raw = TRUE)2 -0.02244 0.001268 -17.69 5380 3.945e-68 -0.02493 -0.01995
fixed NA poly(age, 3, raw = TRUE)3 0.0002255 0.00001439 15.67 5355 3.656e-54 0.0001973 0.0002538
fixed NA male -0.08017 0.01799 -4.457 5229 0.000008468 -0.1154 -0.04492
fixed NA sibling_count3 -0.001263 0.03207 -0.03938 4387 0.9686 -0.06412 0.06159
fixed NA sibling_count4 -0.08503 0.03598 -2.363 4216 0.01815 -0.1555 -0.01452
fixed NA sibling_count5 -0.1895 0.04401 -4.305 4050 0.00001708 -0.2757 -0.1032
fixed NA sibling_count>5 -0.4382 0.04436 -9.88 4498 8.654e-23 -0.5252 -0.3513
ran_pars mother_pidlink sd__(Intercept) 0.5182 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.5672 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -6.674 0.3137 -21.28 5520 1.223e-96 -7.289 -6.06
fixed NA poly(age, 3, raw = TRUE)1 0.7136 0.03554 20.08 5452 1.376e-86 0.6439 0.7832
fixed NA poly(age, 3, raw = TRUE)2 -0.02225 0.001269 -17.53 5405 5.569e-67 -0.02473 -0.01976
fixed NA poly(age, 3, raw = TRUE)3 0.0002238 0.00001439 15.55 5372 2.431e-53 0.0001955 0.000252
fixed NA male -0.08054 0.01796 -4.484 5223 0.000007469 -0.1157 -0.04534
fixed NA sibling_count3 0.00008121 0.03249 0.002499 4521 0.998 -0.06361 0.06377
fixed NA sibling_count4 -0.09508 0.03694 -2.574 4436 0.01008 -0.1675 -0.02268
fixed NA sibling_count5 -0.2215 0.04531 -4.888 4307 0.000001055 -0.3103 -0.1327
fixed NA sibling_count>5 -0.4607 0.04527 -10.18 4652 4.53e-24 -0.5494 -0.372
fixed NA birth_order_nonlinear2 -0.05633 0.02197 -2.563 4526 0.0104 -0.0994 -0.01326
fixed NA birth_order_nonlinear3 0.01674 0.0274 0.611 4708 0.5412 -0.03696 0.07044
fixed NA birth_order_nonlinear4 0.08775 0.03516 2.496 4842 0.0126 0.01884 0.1567
fixed NA birth_order_nonlinear5 0.1372 0.04421 3.105 4611 0.001917 0.0506 0.2239
fixed NA birth_order_nonlinear>5 0.07675 0.04577 1.677 5462 0.09364 -0.01296 0.1665
ran_pars mother_pidlink sd__(Intercept) 0.5176 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.5664 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -6.684 0.3148 -21.24 5529 2.889e-96 -7.301 -6.067
fixed NA poly(age, 3, raw = TRUE)1 0.7138 0.03565 20.02 5456 4.073e-86 0.6439 0.7837
fixed NA poly(age, 3, raw = TRUE)2 -0.02226 0.001273 -17.48 5412 1.261e-66 -0.02476 -0.01977
fixed NA poly(age, 3, raw = TRUE)3 0.000224 0.00001445 15.5 5382 4.495e-53 0.0001957 0.0002523
fixed NA male -0.07992 0.01799 -4.444 5212 0.000009023 -0.1152 -0.04467
fixed NA count_birth_order2/2 -0.02734 0.03915 -0.6983 4900 0.4851 -0.1041 0.0494
fixed NA count_birth_order1/3 0.03303 0.03893 0.8485 5773 0.3962 -0.04327 0.1093
fixed NA count_birth_order2/3 -0.06894 0.04228 -1.63 5973 0.1031 -0.1518 0.01393
fixed NA count_birth_order3/3 0.008928 0.04599 0.1941 6010 0.8461 -0.08122 0.09907
fixed NA count_birth_order1/4 -0.09519 0.04764 -1.998 5963 0.04577 -0.1886 -0.00181
fixed NA count_birth_order2/4 -0.1545 0.04852 -3.184 6008 0.001461 -0.2496 -0.05937
fixed NA count_birth_order3/4 -0.0412 0.05053 -0.8153 5999 0.415 -0.1402 0.05784
fixed NA count_birth_order4/4 0.003472 0.05308 0.06542 5983 0.9478 -0.1006 0.1075
fixed NA count_birth_order1/5 -0.2173 0.06431 -3.379 6011 0.0007323 -0.3434 -0.09126
fixed NA count_birth_order2/5 -0.2431 0.06969 -3.489 5887 0.0004888 -0.3797 -0.1065
fixed NA count_birth_order3/5 -0.1786 0.06617 -2.699 5938 0.006983 -0.3082 -0.04887
fixed NA count_birth_order4/5 -0.1625 0.06474 -2.509 5975 0.01212 -0.2893 -0.03557
fixed NA count_birth_order5/5 -0.06279 0.06813 -0.9216 5918 0.3568 -0.1963 0.07075
fixed NA count_birth_order1/>5 -0.4742 0.06382 -7.43 5906 1.239e-13 -0.5993 -0.3491
fixed NA count_birth_order2/>5 -0.4845 0.06341 -7.64 5868 2.529e-14 -0.6087 -0.3602
fixed NA count_birth_order3/>5 -0.4592 0.06144 -7.474 5834 8.937e-14 -0.5796 -0.3388
fixed NA count_birth_order4/>5 -0.3303 0.06021 -5.486 5791 0.00000004288 -0.4483 -0.2123
fixed NA count_birth_order5/>5 -0.3212 0.05599 -5.737 5896 0.00000001014 -0.431 -0.2115
fixed NA count_birth_order>5/>5 -0.3735 0.04488 -8.322 5726 1.074e-16 -0.4615 -0.2855
ran_pars mother_pidlink sd__(Intercept) 0.5172 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.5669 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 13356 13430 -6667 13334 NA NA NA
12 13352 13432 -6664 13328 6.342 1 0.01179
16 13338 13446 -6653 13306 21.48 4 0.0002543
26 13353 13528 -6651 13301 4.93 10 0.8958

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Elementary missed

birthorder <- birthorder %>% mutate(outcome = Elementary_missed)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.0359 0.07117 -0.5044 7512 0.614 -0.1754 0.1036
fixed NA poly(age, 3, raw = TRUE)1 0.005098 0.008201 0.6217 7522 0.5342 -0.01098 0.02117
fixed NA poly(age, 3, raw = TRUE)2 -0.0001344 0.0002977 -0.4516 7530 0.6516 -0.0007179 0.000449
fixed NA poly(age, 3, raw = TRUE)3 0.000001175 0.00000341 0.3446 7535 0.7304 -0.000005508 0.000007858
fixed NA male 0.01183 0.004139 2.857 7537 0.004287 0.003713 0.01994
fixed NA sibling_count3 -0.004516 0.007623 -0.5924 6593 0.5536 -0.01946 0.01042
fixed NA sibling_count4 0.002375 0.007854 0.3024 6299 0.7623 -0.01302 0.01777
fixed NA sibling_count5 0.0005693 0.008131 0.07002 5736 0.9442 -0.01537 0.0165
fixed NA sibling_count>5 0.01343 0.006512 2.062 6104 0.03929 0.0006617 0.02619
ran_pars mother_pidlink sd__(Intercept) 0.03164 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1769 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.03567 0.07116 -0.5013 7511 0.6162 -0.1751 0.1038
fixed NA birth_order 0.001618 0.000855 1.893 5735 0.05844 -0.00005746 0.003294
fixed NA poly(age, 3, raw = TRUE)1 0.004764 0.008202 0.5809 7522 0.5613 -0.01131 0.02084
fixed NA poly(age, 3, raw = TRUE)2 -0.0001223 0.0002977 -0.4107 7530 0.6813 -0.0007058 0.0004612
fixed NA poly(age, 3, raw = TRUE)3 0.000001066 0.00000341 0.3126 7535 0.7546 -0.000005617 0.000007748
fixed NA male 0.01187 0.004138 2.869 7536 0.00413 0.003762 0.01998
fixed NA sibling_count3 -0.005119 0.007628 -0.6711 6594 0.5022 -0.02007 0.009832
fixed NA sibling_count4 0.0008348 0.007895 0.1057 6293 0.9158 -0.01464 0.01631
fixed NA sibling_count5 -0.001974 0.008239 -0.2396 5702 0.8107 -0.01812 0.01417
fixed NA sibling_count>5 0.005909 0.007626 0.7748 5985 0.4385 -0.009038 0.02086
ran_pars mother_pidlink sd__(Intercept) 0.03155 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1769 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.03677 0.07132 -0.5155 7517 0.6062 -0.1766 0.103
fixed NA poly(age, 3, raw = TRUE)1 0.005009 0.008207 0.6103 7523 0.5417 -0.01108 0.0211
fixed NA poly(age, 3, raw = TRUE)2 -0.0001286 0.000298 -0.4316 7530 0.6661 -0.0007126 0.0004554
fixed NA poly(age, 3, raw = TRUE)3 0.0000011 0.000003412 0.3224 7533 0.7471 -0.000005588 0.000007788
fixed NA male 0.01198 0.00414 2.893 7532 0.003828 0.003862 0.02009
fixed NA sibling_count3 -0.004969 0.007769 -0.6396 6710 0.5225 -0.0202 0.01026
fixed NA sibling_count4 0.004068 0.008262 0.4924 6577 0.6225 -0.01213 0.02026
fixed NA sibling_count5 0.001791 0.008784 0.2039 6146 0.8385 -0.01543 0.01901
fixed NA sibling_count>5 0.009914 0.008273 1.198 6603 0.2309 -0.006302 0.02613
fixed NA birth_order_nonlinear2 0.002091 0.006096 0.3431 7040 0.7316 -0.009856 0.01404
fixed NA birth_order_nonlinear3 0.002502 0.007308 0.3424 7206 0.732 -0.01182 0.01683
fixed NA birth_order_nonlinear4 -0.01034 0.008412 -1.229 7298 0.2192 -0.02682 0.006152
fixed NA birth_order_nonlinear5 0.001859 0.009411 0.1975 7399 0.8434 -0.01659 0.0203
fixed NA birth_order_nonlinear>5 0.009152 0.007986 1.146 7375 0.2518 -0.006501 0.02481
ran_pars mother_pidlink sd__(Intercept) 0.03137 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1769 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.04214 0.07141 -0.5902 7507 0.5551 -0.1821 0.09781
fixed NA poly(age, 3, raw = TRUE)1 0.005408 0.008208 0.6588 7513 0.51 -0.01068 0.02149
fixed NA poly(age, 3, raw = TRUE)2 -0.0001434 0.000298 -0.4811 7520 0.6305 -0.0007274 0.0004407
fixed NA poly(age, 3, raw = TRUE)3 0.000001267 0.000003413 0.3713 7523 0.7104 -0.000005422 0.000007956
fixed NA male 0.01215 0.00414 2.935 7522 0.003347 0.004036 0.02027
fixed NA count_birth_order2/2 0.007844 0.0116 0.6762 7052 0.4989 -0.01489 0.03058
fixed NA count_birth_order1/3 0.001005 0.01024 0.09822 7525 0.9218 -0.01906 0.02107
fixed NA count_birth_order2/3 -0.003272 0.01139 -0.2873 7527 0.7739 -0.02559 0.01905
fixed NA count_birth_order3/3 -0.005575 0.01312 -0.425 7527 0.6709 -0.03129 0.02014
fixed NA count_birth_order1/4 0.006385 0.01209 0.5281 7527 0.5974 -0.01731 0.03008
fixed NA count_birth_order2/4 0.01971 0.01252 1.574 7527 0.1155 -0.004833 0.04425
fixed NA count_birth_order3/4 -0.01251 0.01353 -0.9247 7527 0.3552 -0.03903 0.01401
fixed NA count_birth_order4/4 0.002527 0.01402 0.1803 7527 0.8569 -0.02495 0.03
fixed NA count_birth_order1/5 -0.008057 0.01393 -0.5784 7527 0.563 -0.03536 0.01925
fixed NA count_birth_order2/5 0.008299 0.01493 0.5557 7526 0.5784 -0.02097 0.03757
fixed NA count_birth_order3/5 0.01165 0.01465 0.795 7526 0.4266 -0.01707 0.04037
fixed NA count_birth_order4/5 0.004803 0.01549 0.3101 7526 0.7565 -0.02556 0.03517
fixed NA count_birth_order5/5 0.001672 0.01482 0.1128 7526 0.9102 -0.02737 0.03071
fixed NA count_birth_order1/>5 0.01773 0.01285 1.38 7527 0.1677 -0.007455 0.04291
fixed NA count_birth_order2/>5 -0.001829 0.01301 -0.1406 7527 0.8882 -0.02733 0.02367
fixed NA count_birth_order3/>5 0.03193 0.01249 2.557 7527 0.01058 0.007453 0.05641
fixed NA count_birth_order4/>5 -0.007931 0.01181 -0.6717 7526 0.5018 -0.03107 0.01521
fixed NA count_birth_order5/>5 0.0157 0.01134 1.385 7526 0.1662 -0.006525 0.03793
fixed NA count_birth_order>5/>5 0.02106 0.008272 2.546 7238 0.01092 0.004846 0.03727
ran_pars mother_pidlink sd__(Intercept) 0.0319 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1768 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -4483 -4407 2252 -4505 NA NA NA
12 -4485 -4401 2254 -4509 3.587 1 0.05823
16 -4478 -4367 2255 -4510 1.743 4 0.7829
26 -4472 -4292 2262 -4524 13.98 10 0.1738

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1442 0.1069 -1.349 3962 0.1776 -0.3538 0.06538
fixed NA poly(age, 3, raw = TRUE)1 0.01976 0.01294 1.527 3962 0.1269 -0.005603 0.04512
fixed NA poly(age, 3, raw = TRUE)2 -0.0007469 0.0004952 -1.508 3962 0.1316 -0.001718 0.0002237
fixed NA poly(age, 3, raw = TRUE)3 0.000009176 0.000005979 1.535 3962 0.1249 -0.000002543 0.0000209
fixed NA male 0.006646 0.005295 1.255 3962 0.2095 -0.003731 0.01702
fixed NA sibling_count3 -0.003274 0.007264 -0.4507 3962 0.6522 -0.01751 0.01096
fixed NA sibling_count4 -0.004942 0.008107 -0.6095 3962 0.5422 -0.02083 0.01095
fixed NA sibling_count5 0.002172 0.009593 0.2265 3962 0.8209 -0.01663 0.02097
fixed NA sibling_count>5 0.02326 0.00863 2.696 3962 0.007056 0.006348 0.04018
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1667 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.145 0.107 -1.355 3961 0.1754 -0.3548 0.0647
fixed NA birth_order 0.0004245 0.001896 0.2238 3961 0.8229 -0.003293 0.004142
fixed NA poly(age, 3, raw = TRUE)1 0.0198 0.01294 1.53 3961 0.1262 -0.005568 0.04516
fixed NA poly(age, 3, raw = TRUE)2 -0.0007491 0.0004954 -1.512 3961 0.1306 -0.00172 0.0002219
fixed NA poly(age, 3, raw = TRUE)3 0.000009215 0.000005983 1.54 3961 0.1236 -0.00000251 0.00002094
fixed NA male 0.006655 0.005296 1.257 3961 0.2089 -0.003724 0.01703
fixed NA sibling_count3 -0.003473 0.007319 -0.4746 3961 0.6351 -0.01782 0.01087
fixed NA sibling_count4 -0.005406 0.008369 -0.6459 3961 0.5184 -0.02181 0.011
fixed NA sibling_count5 0.001394 0.0102 0.1366 3961 0.8914 -0.01861 0.02139
fixed NA sibling_count>5 0.02152 0.01163 1.85 3961 0.0644 -0.00128 0.04431
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1667 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1453 0.1071 -1.356 3957 0.175 -0.3552 0.06464
fixed NA poly(age, 3, raw = TRUE)1 0.0198 0.01295 1.529 3957 0.1263 -0.005579 0.04518
fixed NA poly(age, 3, raw = TRUE)2 -0.0007478 0.0004957 -1.509 3957 0.1315 -0.001719 0.0002237
fixed NA poly(age, 3, raw = TRUE)3 0.000009187 0.000005986 1.535 3957 0.125 -0.000002546 0.00002092
fixed NA male 0.006736 0.005298 1.271 3957 0.2037 -0.003648 0.01712
fixed NA sibling_count3 -0.003312 0.007538 -0.4394 3957 0.6604 -0.01809 0.01146
fixed NA sibling_count4 -0.000942 0.008859 -0.1063 3957 0.9153 -0.01831 0.01642
fixed NA sibling_count5 0.007974 0.01095 0.7286 3957 0.4663 -0.01348 0.02943
fixed NA sibling_count>5 0.02341 0.01232 1.9 3957 0.05752 -0.0007407 0.04756
fixed NA birth_order_nonlinear2 0.001382 0.006812 0.2029 3957 0.8392 -0.01197 0.01473
fixed NA birth_order_nonlinear3 0.0001446 0.008687 0.01664 3957 0.9867 -0.01688 0.01717
fixed NA birth_order_nonlinear4 -0.01699 0.01116 -1.523 3957 0.128 -0.03886 0.004881
fixed NA birth_order_nonlinear5 -0.007998 0.01468 -0.5448 3957 0.5859 -0.03677 0.02078
fixed NA birth_order_nonlinear>5 0.007723 0.01497 0.5159 3957 0.606 -0.02162 0.03707
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1667 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.143 0.1073 -1.332 3947 0.1828 -0.3533 0.06734
fixed NA poly(age, 3, raw = TRUE)1 0.0197 0.01297 1.519 3947 0.1289 -0.005722 0.04513
fixed NA poly(age, 3, raw = TRUE)2 -0.0007376 0.0004966 -1.485 3947 0.1375 -0.001711 0.0002357
fixed NA poly(age, 3, raw = TRUE)3 0.000008982 0.000005999 1.497 3947 0.1344 -0.000002776 0.00002074
fixed NA male 0.006549 0.005306 1.234 3947 0.2172 -0.00385 0.01695
fixed NA count_birth_order2/2 -0.006425 0.01127 -0.5701 3947 0.5686 -0.02852 0.01566
fixed NA count_birth_order1/3 -0.01274 0.009904 -1.286 3947 0.1985 -0.03215 0.006674
fixed NA count_birth_order2/3 0.001926 0.01084 0.1776 3947 0.859 -0.01933 0.02318
fixed NA count_birth_order3/3 -0.001935 0.01213 -0.1595 3947 0.8733 -0.02572 0.02185
fixed NA count_birth_order1/4 -0.000406 0.01319 -0.03077 3947 0.9755 -0.02627 0.02545
fixed NA count_birth_order2/4 0.002909 0.01367 0.2127 3947 0.8315 -0.02389 0.02971
fixed NA count_birth_order3/4 -0.01698 0.0144 -1.179 3947 0.2386 -0.04521 0.01125
fixed NA count_birth_order4/4 -0.01695 0.01423 -1.19 3947 0.2339 -0.04485 0.01095
fixed NA count_birth_order1/5 0.005682 0.01916 0.2965 3947 0.7668 -0.03187 0.04324
fixed NA count_birth_order2/5 -0.001842 0.02077 -0.08868 3947 0.9293 -0.04255 0.03887
fixed NA count_birth_order3/5 0.004445 0.01888 0.2354 3947 0.8139 -0.03257 0.04146
fixed NA count_birth_order4/5 -0.0002872 0.01775 -0.01618 3947 0.9871 -0.03508 0.0345
fixed NA count_birth_order5/5 -0.007808 0.01825 -0.4279 3947 0.6687 -0.04357 0.02795
fixed NA count_birth_order1/>5 0.04048 0.02442 1.658 3947 0.09748 -0.007385 0.08835
fixed NA count_birth_order2/>5 0.003233 0.02367 0.1366 3947 0.8913 -0.04315 0.04962
fixed NA count_birth_order3/>5 0.04167 0.02177 1.914 3947 0.05566 -0.0009953 0.08434
fixed NA count_birth_order4/>5 -0.01883 0.0199 -0.9464 3947 0.344 -0.05783 0.02017
fixed NA count_birth_order5/>5 0.01747 0.01754 0.9955 3947 0.3195 -0.01692 0.05185
fixed NA count_birth_order>5/>5 0.02843 0.01179 2.412 3947 0.01592 0.005327 0.05154
ran_pars mother_pidlink sd__(Intercept) 0.0000000083 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1668 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -2946 -2877 1484 -2968 NA NA NA
12 -2944 -2869 1484 -2968 0.05022 1 0.8227
16 -2940 -2840 1486 -2972 4.006 4 0.4052
26 -2929 -2765 1490 -2981 8.27 10 0.6024

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1486 0.1065 -1.395 4006 0.1631 -0.3573 0.06015
fixed NA poly(age, 3, raw = TRUE)1 0.02007 0.01288 1.558 4006 0.1193 -0.00518 0.04533
fixed NA poly(age, 3, raw = TRUE)2 -0.0007564 0.0004933 -1.533 4006 0.1253 -0.001723 0.0002105
fixed NA poly(age, 3, raw = TRUE)3 0.000009311 0.000005958 1.563 4006 0.1182 -0.000002366 0.00002099
fixed NA male 0.006283 0.005263 1.194 4006 0.2326 -0.004032 0.0166
fixed NA sibling_count3 0.00281 0.007829 0.3589 4006 0.7197 -0.01253 0.01815
fixed NA sibling_count4 -0.005559 0.008443 -0.6585 4006 0.5103 -0.02211 0.01099
fixed NA sibling_count5 -0.005294 0.009292 -0.5697 4006 0.5689 -0.02351 0.01292
fixed NA sibling_count>5 0.01816 0.008216 2.21 4006 0.02715 0.002056 0.03426
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1666 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1523 0.1065 -1.429 4005 0.153 -0.3611 0.05653
fixed NA birth_order 0.001729 0.001583 1.092 4005 0.2748 -0.001374 0.004832
fixed NA poly(age, 3, raw = TRUE)1 0.02027 0.01289 1.573 4005 0.1157 -0.004982 0.04553
fixed NA poly(age, 3, raw = TRUE)2 -0.0007663 0.0004934 -1.553 4005 0.1205 -0.001733 0.0002007
fixed NA poly(age, 3, raw = TRUE)3 0.000009479 0.00000596 1.59 4005 0.1118 -0.000002202 0.00002116
fixed NA male 0.006291 0.005263 1.195 4005 0.232 -0.004024 0.01661
fixed NA sibling_count3 0.00197 0.007866 0.2504 4005 0.8023 -0.01345 0.01739
fixed NA sibling_count4 -0.007413 0.008611 -0.8609 4005 0.3894 -0.02429 0.009465
fixed NA sibling_count5 -0.008217 0.00967 -0.8498 4005 0.3955 -0.02717 0.01074
fixed NA sibling_count>5 0.01149 0.01024 1.122 4005 0.2619 -0.008579 0.03155
ran_pars mother_pidlink sd__(Intercept) 0.000000003507 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1666 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1515 0.1067 -1.42 4001 0.1556 -0.3606 0.05755
fixed NA poly(age, 3, raw = TRUE)1 0.02036 0.0129 1.579 4001 0.1145 -0.004919 0.04564
fixed NA poly(age, 3, raw = TRUE)2 -0.0007676 0.0004938 -1.554 4001 0.1202 -0.001735 0.0002004
fixed NA poly(age, 3, raw = TRUE)3 0.000009457 0.000005966 1.585 4001 0.113 -0.000002236 0.00002115
fixed NA male 0.006342 0.005267 1.204 4001 0.2286 -0.003982 0.01667
fixed NA sibling_count3 0.002582 0.008089 0.3193 4001 0.7495 -0.01327 0.01844
fixed NA sibling_count4 -0.004501 0.009063 -0.4966 4001 0.6195 -0.02226 0.01326
fixed NA sibling_count5 -0.003395 0.01036 -0.3278 4001 0.7431 -0.0237 0.01691
fixed NA sibling_count>5 0.01573 0.01075 1.464 4001 0.1433 -0.005334 0.0368
fixed NA birth_order_nonlinear2 0.001636 0.006938 0.2358 4001 0.8136 -0.01196 0.01523
fixed NA birth_order_nonlinear3 0.0009229 0.008591 0.1074 4001 0.9145 -0.01592 0.01776
fixed NA birth_order_nonlinear4 -0.005306 0.01049 -0.506 4001 0.6129 -0.02586 0.01525
fixed NA birth_order_nonlinear5 -0.003994 0.0136 -0.2938 4001 0.7689 -0.03064 0.02265
fixed NA birth_order_nonlinear>5 0.009254 0.0127 0.7289 4001 0.4661 -0.01563 0.03414
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1666 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1472 0.1069 -1.377 3991 0.1684 -0.3566 0.06224
fixed NA poly(age, 3, raw = TRUE)1 0.02004 0.01292 1.552 3991 0.1208 -0.005274 0.04535
fixed NA poly(age, 3, raw = TRUE)2 -0.000755 0.0004946 -1.527 3991 0.1269 -0.001724 0.0002143
fixed NA poly(age, 3, raw = TRUE)3 0.000009301 0.000005975 1.557 3991 0.1196 -0.000002408 0.00002101
fixed NA male 0.006449 0.005273 1.223 3991 0.2214 -0.003887 0.01678
fixed NA count_birth_order2/2 -0.003815 0.01228 -0.3108 3991 0.756 -0.02788 0.02025
fixed NA count_birth_order1/3 -0.003669 0.01069 -0.3433 3991 0.7314 -0.02461 0.01728
fixed NA count_birth_order2/3 0.007273 0.0116 0.6268 3991 0.5308 -0.01547 0.03001
fixed NA count_birth_order3/3 0.003067 0.01296 0.2366 3991 0.813 -0.02234 0.02847
fixed NA count_birth_order1/4 0.0007049 0.01346 0.05236 3991 0.9582 -0.02568 0.02709
fixed NA count_birth_order2/4 0.001997 0.01358 0.147 3991 0.8831 -0.02462 0.02861
fixed NA count_birth_order3/4 -0.02048 0.01513 -1.354 3991 0.1759 -0.05014 0.009174
fixed NA count_birth_order4/4 -0.01489 0.01471 -1.012 3991 0.3116 -0.04372 0.01394
fixed NA count_birth_order1/5 -0.01108 0.01672 -0.6626 3991 0.5076 -0.04386 0.0217
fixed NA count_birth_order2/5 -0.005183 0.01899 -0.2729 3991 0.7849 -0.0424 0.03204
fixed NA count_birth_order3/5 -0.008834 0.01738 -0.5082 3991 0.6113 -0.0429 0.02523
fixed NA count_birth_order4/5 -0.008066 0.0178 -0.4531 3991 0.6505 -0.04296 0.02683
fixed NA count_birth_order5/5 0.0008635 0.01743 0.04954 3991 0.9605 -0.0333 0.03502
fixed NA count_birth_order1/>5 0.0153 0.01781 0.8591 3991 0.3903 -0.0196 0.05021
fixed NA count_birth_order2/>5 -0.006775 0.01984 -0.3415 3991 0.7328 -0.04566 0.03211
fixed NA count_birth_order3/>5 0.04067 0.01842 2.208 3991 0.02731 0.004567 0.07677
fixed NA count_birth_order4/>5 0.01091 0.01658 0.6578 3991 0.5107 -0.02159 0.0434
fixed NA count_birth_order5/>5 -0.0003145 0.01759 -0.01788 3991 0.9857 -0.03479 0.03417
fixed NA count_birth_order>5/>5 0.02317 0.01124 2.062 3991 0.03928 0.001146 0.0452
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1667 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -2986 -2917 1504 -3008 NA NA NA
12 -2985 -2910 1505 -3009 1.196 1 0.2742
16 -2977 -2877 1505 -3009 0.2612 4 0.9922
26 -2965 -2802 1509 -3017 7.849 10 0.6436

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1524 0.1069 -1.425 3877 0.1543 -0.362 0.05723
fixed NA poly(age, 3, raw = TRUE)1 0.02052 0.01293 1.587 3877 0.1127 -0.004829 0.04587
fixed NA poly(age, 3, raw = TRUE)2 -0.0007638 0.0004946 -1.544 3877 0.1226 -0.001733 0.0002056
fixed NA poly(age, 3, raw = TRUE)3 0.0000093 0.000005968 1.558 3877 0.1193 -0.000002398 0.000021
fixed NA male 0.004826 0.005319 0.9073 3877 0.3643 -0.005599 0.01525
fixed NA sibling_count3 -0.001595 0.00716 -0.2227 3877 0.8238 -0.01563 0.01244
fixed NA sibling_count4 -0.007724 0.008028 -0.9621 3877 0.3361 -0.02346 0.008011
fixed NA sibling_count5 0.002436 0.009835 0.2477 3877 0.8044 -0.01684 0.02171
fixed NA sibling_count>5 0.02079 0.008775 2.37 3877 0.01786 0.003594 0.03799
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1656 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1561 0.107 -1.459 3876 0.1447 -0.3658 0.05362
fixed NA birth_order 0.002012 0.001944 1.035 3876 0.3008 -0.001798 0.005823
fixed NA poly(age, 3, raw = TRUE)1 0.02069 0.01293 1.599 3876 0.1098 -0.004663 0.04604
fixed NA poly(age, 3, raw = TRUE)2 -0.0007734 0.0004947 -1.563 3876 0.118 -0.001743 0.0001961
fixed NA poly(age, 3, raw = TRUE)3 0.00000948 0.000005971 1.588 3876 0.1124 -0.000002222 0.00002118
fixed NA male 0.004883 0.005319 0.9181 3876 0.3586 -0.005542 0.01531
fixed NA sibling_count3 -0.002519 0.007215 -0.3492 3876 0.727 -0.01666 0.01162
fixed NA sibling_count4 -0.00991 0.008301 -1.194 3876 0.2327 -0.02618 0.006361
fixed NA sibling_count5 -0.001106 0.01041 -0.1062 3876 0.9154 -0.02152 0.0193
fixed NA sibling_count>5 0.01253 0.01187 1.056 3876 0.2912 -0.01073 0.03578
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1656 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1555 0.1071 -1.451 3872 0.1468 -0.3654 0.0545
fixed NA poly(age, 3, raw = TRUE)1 0.02077 0.01294 1.605 3872 0.1087 -0.004599 0.04613
fixed NA poly(age, 3, raw = TRUE)2 -0.0007756 0.000495 -1.567 3872 0.1173 -0.001746 0.0001947
fixed NA poly(age, 3, raw = TRUE)3 0.000009493 0.000005975 1.589 3872 0.1122 -0.000002219 0.0000212
fixed NA male 0.004933 0.005323 0.9269 3872 0.3541 -0.005499 0.01537
fixed NA sibling_count3 -0.002476 0.007436 -0.333 3872 0.7391 -0.01705 0.0121
fixed NA sibling_count4 -0.006352 0.008807 -0.7213 3872 0.4707 -0.02361 0.01091
fixed NA sibling_count5 0.005045 0.01113 0.4534 3872 0.6503 -0.01677 0.02686
fixed NA sibling_count>5 0.0149 0.01266 1.177 3872 0.2394 -0.009919 0.03972
fixed NA birth_order_nonlinear2 0.003457 0.006762 0.5112 3872 0.6092 -0.009797 0.01671
fixed NA birth_order_nonlinear3 0.004017 0.008668 0.4635 3872 0.6431 -0.01297 0.02101
fixed NA birth_order_nonlinear4 -0.009119 0.01146 -0.7957 3872 0.4263 -0.03158 0.01334
fixed NA birth_order_nonlinear5 -0.003768 0.0153 -0.2462 3872 0.8055 -0.03376 0.02623
fixed NA birth_order_nonlinear>5 0.01701 0.01547 1.1 3872 0.2716 -0.01331 0.04734
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1656 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1605 0.1074 -1.495 3862 0.1351 -0.371 0.04999
fixed NA poly(age, 3, raw = TRUE)1 0.02159 0.01297 1.664 3862 0.09624 -0.003843 0.04702
fixed NA poly(age, 3, raw = TRUE)2 -0.0008016 0.0004963 -1.615 3862 0.1064 -0.001774 0.0001712
fixed NA poly(age, 3, raw = TRUE)3 0.000009745 0.000005992 1.626 3862 0.104 -0.000001999 0.00002149
fixed NA male 0.005014 0.005333 0.9402 3862 0.3472 -0.005438 0.01547
fixed NA count_birth_order2/2 -0.004404 0.0109 -0.404 3862 0.6862 -0.02577 0.01696
fixed NA count_birth_order1/3 -0.01262 0.009776 -1.291 3862 0.1968 -0.03178 0.00654
fixed NA count_birth_order2/3 0.003637 0.01089 0.334 3862 0.7384 -0.01771 0.02498
fixed NA count_birth_order3/3 0.005645 0.01197 0.4714 3862 0.6374 -0.01782 0.02911
fixed NA count_birth_order1/4 -0.004056 0.01325 -0.3062 3862 0.7595 -0.03002 0.02191
fixed NA count_birth_order2/4 -0.001733 0.01367 -0.1268 3862 0.8991 -0.02852 0.02505
fixed NA count_birth_order3/4 -0.01717 0.01406 -1.222 3862 0.222 -0.04472 0.01038
fixed NA count_birth_order4/4 -0.01619 0.01435 -1.128 3862 0.2594 -0.04431 0.01194
fixed NA count_birth_order1/5 0.006246 0.01912 0.3266 3862 0.744 -0.03123 0.04372
fixed NA count_birth_order2/5 0.0009551 0.02176 0.04389 3862 0.965 -0.0417 0.04361
fixed NA count_birth_order3/5 0.009442 0.01987 0.4752 3862 0.6347 -0.0295 0.04839
fixed NA count_birth_order4/5 0.003884 0.01857 0.2091 3862 0.8344 -0.03252 0.04029
fixed NA count_birth_order5/5 -0.01661 0.0193 -0.8607 3862 0.3895 -0.05445 0.02122
fixed NA count_birth_order1/>5 0.02319 0.02464 0.9411 3862 0.3467 -0.02511 0.07149
fixed NA count_birth_order2/>5 0.005438 0.02432 0.2236 3862 0.8231 -0.04223 0.0531
fixed NA count_birth_order3/>5 0.01683 0.02315 0.7271 3862 0.4672 -0.02854 0.0622
fixed NA count_birth_order4/>5 -0.01712 0.02153 -0.7949 3862 0.4267 -0.05932 0.02509
fixed NA count_birth_order5/>5 0.02131 0.01811 1.177 3862 0.2393 -0.01418 0.0568
fixed NA count_birth_order>5/>5 0.02908 0.01199 2.425 3862 0.01534 0.005578 0.05258
ran_pars mother_pidlink sd__(Intercept) 0.000000004709 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1657 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -2935 -2866 1478 -2957 NA NA NA
12 -2934 -2859 1479 -2958 1.074 1 0.3001
16 -2928 -2828 1480 -2960 2.375 4 0.6672
26 -2915 -2752 1483 -2967 6.831 10 0.7413

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Elementary worked

birthorder <- birthorder %>% mutate(outcome = Elementary_worked)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.07964 0.08885 -0.8964 7460 0.3701 -0.2538 0.0945
fixed NA poly(age, 3, raw = TRUE)1 0.00962 0.01022 0.9411 7478 0.3467 -0.01041 0.02966
fixed NA poly(age, 3, raw = TRUE)2 -0.0003134 0.0003703 -0.8464 7496 0.3974 -0.001039 0.0004123
fixed NA poly(age, 3, raw = TRUE)3 0.000004026 0.00000423 0.9519 7508 0.3412 -0.000004264 0.00001232
fixed NA male 0.03192 0.005231 6.103 7480 0.000000001094 0.02167 0.04218
fixed NA sibling_count3 -0.008452 0.009849 -0.8582 6513 0.3908 -0.02776 0.01085
fixed NA sibling_count4 0.00381 0.01018 0.3744 6259 0.7081 -0.01613 0.02375
fixed NA sibling_count5 0.01119 0.01059 1.057 5819 0.2907 -0.009562 0.03194
fixed NA sibling_count>5 0.03482 0.008449 4.122 6134 0.00003812 0.01826 0.05138
ran_pars mother_pidlink sd__(Intercept) 0.08269 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2132 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.07986 0.08885 -0.8988 7460 0.3688 -0.254 0.09429
fixed NA birth_order 0.0009563 0.001108 0.8631 6682 0.3881 -0.001215 0.003128
fixed NA poly(age, 3, raw = TRUE)1 0.009444 0.01022 0.9236 7477 0.3557 -0.0106 0.02948
fixed NA poly(age, 3, raw = TRUE)2 -0.0003064 0.0003704 -0.8273 7496 0.4081 -0.001032 0.0004195
fixed NA poly(age, 3, raw = TRUE)3 0.000003962 0.00000423 0.9364 7509 0.3491 -0.00000433 0.00001225
fixed NA male 0.03195 0.005231 6.108 7479 0.000000001057 0.0217 0.04221
fixed NA sibling_count3 -0.008806 0.009856 -0.8934 6515 0.3717 -0.02812 0.01051
fixed NA sibling_count4 0.002898 0.01023 0.2833 6262 0.777 -0.01715 0.02295
fixed NA sibling_count5 0.009665 0.01073 0.9007 5807 0.3678 -0.01137 0.0307
fixed NA sibling_count>5 0.03038 0.009896 3.069 6192 0.002154 0.01098 0.04977
ran_pars mother_pidlink sd__(Intercept) 0.08257 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2133 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.0841 0.08913 -0.9436 7479 0.3454 -0.2588 0.09058
fixed NA poly(age, 3, raw = TRUE)1 0.009802 0.01024 0.9574 7489 0.3384 -0.01026 0.02987
fixed NA poly(age, 3, raw = TRUE)2 -0.0003176 0.0003709 -0.8565 7504 0.3918 -0.001044 0.0004092
fixed NA poly(age, 3, raw = TRUE)3 0.000004062 0.000004236 0.9589 7514 0.3376 -0.00000424 0.00001236
fixed NA male 0.03209 0.005232 6.133 7475 0.000000000905 0.02184 0.04234
fixed NA sibling_count3 -0.008324 0.01002 -0.8303 6630 0.4064 -0.02797 0.01132
fixed NA sibling_count4 0.006027 0.01067 0.5647 6544 0.5723 -0.01489 0.02695
fixed NA sibling_count5 0.01112 0.01139 0.9759 6225 0.3291 -0.01121 0.03344
fixed NA sibling_count>5 0.0318 0.01067 2.979 6720 0.002901 0.01088 0.05271
fixed NA birth_order_nonlinear2 0.006231 0.007625 0.8172 6954 0.4139 -0.008714 0.02118
fixed NA birth_order_nonlinear3 0.0001958 0.009161 0.02138 7069 0.9829 -0.01776 0.01815
fixed NA birth_order_nonlinear4 -0.008989 0.01056 -0.8511 7141 0.3947 -0.02969 0.01171
fixed NA birth_order_nonlinear5 0.01249 0.01183 1.056 7243 0.2911 -0.01069 0.03567
fixed NA birth_order_nonlinear>5 0.007857 0.01017 0.7724 7531 0.4399 -0.01208 0.02779
ran_pars mother_pidlink sd__(Intercept) 0.08259 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2133 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.08246 0.08926 -0.9238 7472 0.3556 -0.2574 0.09248
fixed NA poly(age, 3, raw = TRUE)1 0.009748 0.01024 0.952 7480 0.3412 -0.01032 0.02982
fixed NA poly(age, 3, raw = TRUE)2 -0.0003177 0.000371 -0.8564 7495 0.3918 -0.001045 0.0004094
fixed NA poly(age, 3, raw = TRUE)3 0.000004095 0.000004238 0.9664 7505 0.3339 -0.00000421 0.0000124
fixed NA male 0.03227 0.005234 6.167 7465 0.0000000007337 0.02202 0.04253
fixed NA count_birth_order2/2 0.00326 0.01454 0.2242 7097 0.8226 -0.02524 0.03176
fixed NA count_birth_order1/3 -0.004176 0.013 -0.3212 7516 0.748 -0.02966 0.0213
fixed NA count_birth_order2/3 0.0007817 0.01446 0.05408 7534 0.9569 -0.02755 0.02912
fixed NA count_birth_order3/3 -0.02654 0.01664 -1.595 7537 0.1108 -0.05916 0.006077
fixed NA count_birth_order1/4 0.001379 0.01533 0.08991 7533 0.9284 -0.02868 0.03143
fixed NA count_birth_order2/4 0.01607 0.01589 1.011 7537 0.3118 -0.01507 0.04722
fixed NA count_birth_order3/4 0.001507 0.01716 0.08783 7536 0.93 -0.03213 0.03514
fixed NA count_birth_order4/4 -0.00101 0.01778 -0.05678 7537 0.9547 -0.03586 0.03384
fixed NA count_birth_order1/5 0.02121 0.01767 1.2 7537 0.2302 -0.01343 0.05585
fixed NA count_birth_order2/5 0.008517 0.01889 0.451 7527 0.652 -0.0285 0.04553
fixed NA count_birth_order3/5 -0.004503 0.01857 -0.2426 7523 0.8084 -0.04089 0.03189
fixed NA count_birth_order4/5 0.01404 0.01963 0.7155 7522 0.4743 -0.02443 0.05252
fixed NA count_birth_order5/5 0.02075 0.01878 1.105 7533 0.2694 -0.01607 0.05756
fixed NA count_birth_order1/>5 0.01348 0.01626 0.829 7520 0.4071 -0.01839 0.04536
fixed NA count_birth_order2/>5 0.03364 0.01647 2.043 7520 0.0411 0.001366 0.06592
fixed NA count_birth_order3/>5 0.05796 0.0158 3.669 7510 0.0002454 0.027 0.08893
fixed NA count_birth_order4/>5 0.01383 0.01495 0.9249 7514 0.355 -0.01548 0.04314
fixed NA count_birth_order5/>5 0.04418 0.01434 3.08 7522 0.00208 0.01606 0.07229
fixed NA count_birth_order>5/>5 0.03869 0.01059 3.654 7264 0.0002602 0.01793 0.05944
ran_pars mother_pidlink sd__(Intercept) 0.08253 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2133 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -891.6 -815.4 456.8 -913.6 NA NA NA
12 -890.4 -807.2 457.2 -914.4 0.7467 1 0.3875
16 -885.9 -775 458.9 -917.9 3.481 4 0.4807
26 -877 -696.8 464.5 -929 11.14 10 0.3467

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01121 0.12 0.09338 3918 0.9256 -0.224 0.2464
fixed NA poly(age, 3, raw = TRUE)1 -0.0008552 0.01454 -0.05884 3928 0.9531 -0.02934 0.02763
fixed NA poly(age, 3, raw = TRUE)2 0.0000577 0.0005569 0.1036 3939 0.9175 -0.001034 0.001149
fixed NA poly(age, 3, raw = TRUE)3 -0.000001182 0.000006732 -0.1755 3949 0.8607 -0.00001438 0.00001201
fixed NA male 0.02491 0.005955 4.183 3935 0.00002942 0.01324 0.03658
fixed NA sibling_count3 0.003041 0.008421 0.3611 3312 0.718 -0.01346 0.01955
fixed NA sibling_count4 0.02978 0.00946 3.148 3099 0.001658 0.01124 0.04832
fixed NA sibling_count5 0.02227 0.01122 1.984 3015 0.04733 0.0002712 0.04427
fixed NA sibling_count>5 0.0533 0.01018 5.234 2763 0.0000001787 0.03334 0.07327
ran_pars mother_pidlink sd__(Intercept) 0.07007 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.175 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01518 0.1201 0.1263 3920 0.8995 -0.2203 0.2506
fixed NA birth_order -0.001798 0.002186 -0.8224 3737 0.4109 -0.006082 0.002487
fixed NA poly(age, 3, raw = TRUE)1 -0.001049 0.01454 -0.07217 3928 0.9425 -0.02954 0.02745
fixed NA poly(age, 3, raw = TRUE)2 0.00006671 0.000557 0.1198 3939 0.9047 -0.001025 0.001159
fixed NA poly(age, 3, raw = TRUE)3 -0.000001341 0.000006735 -0.1991 3948 0.8422 -0.00001454 0.00001186
fixed NA male 0.02488 0.005956 4.178 3934 0.00003003 0.01321 0.03656
fixed NA sibling_count3 0.003896 0.008485 0.4591 3310 0.6462 -0.01273 0.02053
fixed NA sibling_count4 0.03179 0.00977 3.254 3089 0.001151 0.01264 0.05094
fixed NA sibling_count5 0.02563 0.01194 2.146 3024 0.03197 0.002219 0.04903
fixed NA sibling_count>5 0.0608 0.01367 4.448 2965 0.000008989 0.03401 0.0876
ran_pars mother_pidlink sd__(Intercept) 0.07 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1751 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01003 0.1203 0.0834 3922 0.9335 -0.2258 0.2459
fixed NA poly(age, 3, raw = TRUE)1 -0.00082 0.01455 -0.05634 3928 0.9551 -0.02935 0.02771
fixed NA poly(age, 3, raw = TRUE)2 0.00005832 0.0005576 0.1046 3937 0.9167 -0.001035 0.001151
fixed NA poly(age, 3, raw = TRUE)3 -0.000001221 0.000006742 -0.181 3946 0.8563 -0.00001443 0.00001199
fixed NA male 0.02492 0.00596 4.182 3930 0.00002952 0.01324 0.0366
fixed NA sibling_count3 0.002344 0.008719 0.2688 3405 0.7881 -0.01475 0.01943
fixed NA sibling_count4 0.03282 0.0103 3.186 3262 0.001456 0.01263 0.053
fixed NA sibling_count5 0.02701 0.01274 2.121 3255 0.03402 0.002048 0.05197
fixed NA sibling_count>5 0.05584 0.01442 3.871 3144 0.0001104 0.02757 0.08411
fixed NA birth_order_nonlinear2 0.001738 0.007499 0.2318 3389 0.8167 -0.01296 0.01644
fixed NA birth_order_nonlinear3 0.003074 0.009668 0.318 3735 0.7505 -0.01587 0.02202
fixed NA birth_order_nonlinear4 -0.01505 0.01247 -1.206 3836 0.2277 -0.03949 0.009398
fixed NA birth_order_nonlinear5 -0.007201 0.01644 -0.4379 3861 0.6615 -0.03943 0.02503
fixed NA birth_order_nonlinear>5 0.001383 0.0171 0.0809 3914 0.9355 -0.03214 0.0349
ran_pars mother_pidlink sd__(Intercept) 0.07028 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.175 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.02475 0.1206 0.2052 3914 0.8374 -0.2116 0.2611
fixed NA poly(age, 3, raw = TRUE)1 -0.002739 0.01459 -0.1878 3919 0.851 -0.03133 0.02585
fixed NA poly(age, 3, raw = TRUE)2 0.0001345 0.0005589 0.2407 3928 0.8098 -0.0009609 0.00123
fixed NA poly(age, 3, raw = TRUE)3 -0.000002188 0.000006758 -0.3238 3937 0.7461 -0.00001543 0.00001106
fixed NA male 0.02456 0.005969 4.114 3919 0.00003972 0.01286 0.03625
fixed NA count_birth_order2/2 0.004317 0.01246 0.3465 3562 0.729 -0.0201 0.02874
fixed NA count_birth_order1/3 0.003408 0.01118 0.3048 3945 0.7605 -0.01851 0.02532
fixed NA count_birth_order2/3 0.006332 0.01223 0.5179 3947 0.6046 -0.01763 0.03029
fixed NA count_birth_order3/3 0.004064 0.01367 0.2972 3947 0.7663 -0.02274 0.03086
fixed NA count_birth_order1/4 0.03974 0.01488 2.671 3948 0.007602 0.01058 0.06891
fixed NA count_birth_order2/4 0.02834 0.0154 1.84 3940 0.0659 -0.001853 0.05853
fixed NA count_birth_order3/4 0.02931 0.01621 1.808 3933 0.07065 -0.002461 0.06109
fixed NA count_birth_order4/4 0.02599 0.01604 1.62 3947 0.1053 -0.005454 0.05743
fixed NA count_birth_order1/5 0.00689 0.0216 0.319 3946 0.7498 -0.03545 0.04923
fixed NA count_birth_order2/5 0.03487 0.02336 1.492 3913 0.1357 -0.01092 0.08066
fixed NA count_birth_order3/5 0.0276 0.02126 1.298 3931 0.1943 -0.01407 0.06927
fixed NA count_birth_order4/5 0.01066 0.01998 0.5339 3932 0.5935 -0.02849 0.04982
fixed NA count_birth_order5/5 0.04122 0.02055 2.006 3943 0.04496 0.0009388 0.08151
fixed NA count_birth_order1/>5 0.07669 0.02748 2.791 3897 0.005277 0.02284 0.1305
fixed NA count_birth_order2/>5 0.05725 0.02663 2.15 3898 0.03161 0.005063 0.1094
fixed NA count_birth_order3/>5 0.09302 0.02448 3.799 3898 0.0001475 0.04503 0.141
fixed NA count_birth_order4/>5 0.02899 0.02237 1.296 3894 0.1949 -0.01484 0.07283
fixed NA count_birth_order5/>5 0.0316 0.01974 1.601 3915 0.1094 -0.007081 0.07028
fixed NA count_birth_order>5/>5 0.05784 0.01354 4.272 3737 0.00001987 0.0313 0.08438
ran_pars mother_pidlink sd__(Intercept) 0.07014 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1751 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -1991 -1922 1007 -2013 NA NA NA
12 -1990 -1915 1007 -2014 0.6787 1 0.41
16 -1984 -1883 1008 -2016 1.76 4 0.7799
26 -1971 -1808 1012 -2023 7.601 10 0.6677

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.0002828 0.1195 0.002366 3962 0.9981 -0.234 0.2345
fixed NA poly(age, 3, raw = TRUE)1 0.0006424 0.01447 0.04439 3972 0.9646 -0.02772 0.02901
fixed NA poly(age, 3, raw = TRUE)2 -0.000002017 0.0005547 -0.003637 3983 0.9971 -0.001089 0.001085
fixed NA poly(age, 3, raw = TRUE)3 -0.0000003936 0.000006707 -0.05869 3993 0.9532 -0.00001354 0.00001275
fixed NA male 0.02545 0.005918 4.3 3978 0.00001749 0.01385 0.03704
fixed NA sibling_count3 -0.002779 0.009064 -0.3066 3402 0.7592 -0.02054 0.01499
fixed NA sibling_count4 0.02307 0.009816 2.35 3263 0.01884 0.003827 0.0423
fixed NA sibling_count5 0.02523 0.01087 2.321 3044 0.02033 0.003927 0.04653
fixed NA sibling_count>5 0.03975 0.009611 4.136 3090 0.00003634 0.02091 0.05859
ran_pars mother_pidlink sd__(Intercept) 0.07022 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1748 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.001055 0.1196 0.008822 3964 0.993 -0.2334 0.2355
fixed NA birth_order -0.0003297 0.001834 -0.1797 3665 0.8574 -0.003925 0.003265
fixed NA poly(age, 3, raw = TRUE)1 0.000602 0.01448 0.04159 3972 0.9668 -0.02777 0.02897
fixed NA poly(age, 3, raw = TRUE)2 -0.0000002517 0.0005548 -0.0004536 3982 0.9996 -0.001088 0.001087
fixed NA poly(age, 3, raw = TRUE)3 -0.000000423 0.00000671 -0.06305 3992 0.9497 -0.00001357 0.00001273
fixed NA male 0.02545 0.005918 4.299 3977 0.00001753 0.01385 0.03705
fixed NA sibling_count3 -0.002616 0.009111 -0.2872 3397 0.774 -0.02047 0.01524
fixed NA sibling_count4 0.02343 0.01002 2.338 3242 0.01946 0.003786 0.04307
fixed NA sibling_count5 0.02579 0.01132 2.279 3035 0.02273 0.003612 0.04798
fixed NA sibling_count>5 0.04103 0.01196 3.43 3190 0.0006104 0.01759 0.06447
ran_pars mother_pidlink sd__(Intercept) 0.07023 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1748 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.00532 0.1198 -0.04442 3966 0.9646 -0.2401 0.2294
fixed NA poly(age, 3, raw = TRUE)1 0.00107 0.01449 0.07384 3972 0.9411 -0.02733 0.02947
fixed NA poly(age, 3, raw = TRUE)2 -0.00001789 0.0005553 -0.03221 3981 0.9743 -0.001106 0.001071
fixed NA poly(age, 3, raw = TRUE)3 -0.0000001971 0.000006716 -0.02934 3990 0.9766 -0.00001336 0.00001297
fixed NA male 0.02563 0.005921 4.329 3973 0.00001537 0.01403 0.03724
fixed NA sibling_count3 -0.002255 0.009346 -0.2413 3477 0.8093 -0.02057 0.01606
fixed NA sibling_count4 0.0258 0.0105 2.456 3383 0.0141 0.005212 0.04639
fixed NA sibling_count5 0.02825 0.01205 2.344 3245 0.01913 0.00463 0.05187
fixed NA sibling_count>5 0.03817 0.01249 3.057 3382 0.002253 0.0137 0.06264
fixed NA birth_order_nonlinear2 0.00555 0.007641 0.7263 3474 0.4677 -0.009427 0.02053
fixed NA birth_order_nonlinear3 -0.002217 0.009564 -0.2318 3800 0.8167 -0.02096 0.01653
fixed NA birth_order_nonlinear4 -0.008889 0.01172 -0.7585 3890 0.4482 -0.03186 0.01408
fixed NA birth_order_nonlinear5 0.00004574 0.01522 0.003004 3917 0.9976 -0.02979 0.02989
fixed NA birth_order_nonlinear>5 0.01021 0.01449 0.7042 3945 0.4813 -0.0182 0.03861
ran_pars mother_pidlink sd__(Intercept) 0.07045 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1747 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.001061 0.12 0.008841 3959 0.9929 -0.2342 0.2363
fixed NA poly(age, 3, raw = TRUE)1 0.0001726 0.01452 0.01189 3964 0.9905 -0.02828 0.02862
fixed NA poly(age, 3, raw = TRUE)2 0.00001582 0.0005564 0.02843 3972 0.9773 -0.001075 0.001106
fixed NA poly(age, 3, raw = TRUE)3 -0.0000005898 0.000006729 -0.08766 3981 0.9302 -0.00001378 0.0000126
fixed NA male 0.02548 0.005931 4.297 3964 0.00001775 0.01386 0.03711
fixed NA count_birth_order2/2 0.008978 0.01357 0.6614 3612 0.5084 -0.01763 0.03558
fixed NA count_birth_order1/3 0.003922 0.01206 0.3251 3989 0.7451 -0.01972 0.02757
fixed NA count_birth_order2/3 0.0002864 0.01308 0.02189 3992 0.9825 -0.02535 0.02592
fixed NA count_birth_order3/3 -0.007098 0.01461 -0.4859 3991 0.6271 -0.03573 0.02153
fixed NA count_birth_order1/4 0.02279 0.01518 1.501 3992 0.1335 -0.006973 0.05255
fixed NA count_birth_order2/4 0.02978 0.0153 1.946 3990 0.0517 -0.0002105 0.05978
fixed NA count_birth_order3/4 0.01887 0.01703 1.108 3977 0.2679 -0.01451 0.05225
fixed NA count_birth_order4/4 0.03166 0.01658 1.91 3992 0.05627 -0.0008367 0.06416
fixed NA count_birth_order1/5 0.03335 0.01886 1.768 3992 0.07708 -0.003614 0.07031
fixed NA count_birth_order2/5 0.04802 0.02126 2.259 3953 0.02394 0.006355 0.08968
fixed NA count_birth_order3/5 0.02118 0.01957 1.083 3976 0.279 -0.01716 0.05953
fixed NA count_birth_order4/5 0.01393 0.02002 0.6957 3966 0.4867 -0.02531 0.05317
fixed NA count_birth_order5/5 0.02655 0.01963 1.353 3986 0.1762 -0.01191 0.06502
fixed NA count_birth_order1/>5 0.02823 0.02007 1.407 3985 0.1596 -0.01111 0.06756
fixed NA count_birth_order2/>5 0.0452 0.02232 2.025 3953 0.04292 0.001454 0.08894
fixed NA count_birth_order3/>5 0.06224 0.02072 3.003 3965 0.002687 0.02162 0.1029
fixed NA count_birth_order4/>5 0.01788 0.01865 0.9585 3966 0.3379 -0.01868 0.05443
fixed NA count_birth_order5/>5 0.04218 0.01978 2.132 3960 0.03305 0.003409 0.08096
fixed NA count_birth_order>5/>5 0.04944 0.01289 3.835 3796 0.0001278 0.02417 0.07471
ran_pars mother_pidlink sd__(Intercept) 0.0702 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1749 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -2022 -1953 1022 -2044 NA NA NA
12 -2020 -1945 1022 -2044 0.03257 1 0.8568
16 -2015 -1914 1023 -2047 2.509 4 0.6429
26 -2000 -1837 1026 -2052 5.464 10 0.8581

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01789 0.1209 0.148 3834 0.8823 -0.219 0.2548
fixed NA poly(age, 3, raw = TRUE)1 -0.001561 0.01463 -0.1067 3844 0.9151 -0.03023 0.02711
fixed NA poly(age, 3, raw = TRUE)2 0.00008934 0.0005601 0.1595 3855 0.8733 -0.001008 0.001187
fixed NA poly(age, 3, raw = TRUE)3 -0.000001613 0.000006766 -0.2384 3865 0.8116 -0.00001487 0.00001165
fixed NA male 0.02612 0.006023 4.337 3849 0.0000148 0.01432 0.03793
fixed NA sibling_count3 0.0007046 0.008364 0.08425 3225 0.9329 -0.01569 0.0171
fixed NA sibling_count4 0.021 0.009442 2.224 3009 0.02622 0.002494 0.03951
fixed NA sibling_count5 0.02668 0.01162 2.295 2866 0.02181 0.003894 0.04946
fixed NA sibling_count>5 0.05476 0.01044 5.245 2673 0.0000001689 0.03429 0.07522
ran_pars mother_pidlink sd__(Intercept) 0.07021 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1751 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.02227 0.121 0.1841 3836 0.8539 -0.2148 0.2594
fixed NA birth_order -0.002079 0.00225 -0.9241 3712 0.3555 -0.006489 0.002331
fixed NA poly(age, 3, raw = TRUE)1 -0.001768 0.01463 -0.1208 3844 0.9039 -0.03044 0.02691
fixed NA poly(age, 3, raw = TRUE)2 0.00009948 0.0005602 0.1776 3854 0.8591 -0.0009985 0.001197
fixed NA poly(age, 3, raw = TRUE)3 -0.000001796 0.000006769 -0.2653 3864 0.7908 -0.00001506 0.00001147
fixed NA male 0.02607 0.006024 4.328 3848 0.0000154 0.01427 0.03788
fixed NA sibling_count3 0.001673 0.008429 0.1985 3222 0.8426 -0.01485 0.01819
fixed NA sibling_count4 0.02331 0.009766 2.387 3005 0.01707 0.004166 0.04245
fixed NA sibling_count5 0.03041 0.0123 2.471 2887 0.01352 0.006292 0.05452
fixed NA sibling_count>5 0.06342 0.01403 4.52 2945 0.000006415 0.03592 0.09091
ran_pars mother_pidlink sd__(Intercept) 0.07014 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1751 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.0182 0.1212 0.1502 3840 0.8806 -0.2193 0.2557
fixed NA poly(age, 3, raw = TRUE)1 -0.001587 0.01465 -0.1083 3844 0.9137 -0.0303 0.02712
fixed NA poly(age, 3, raw = TRUE)2 0.00009018 0.0005608 0.1608 3853 0.8722 -0.001009 0.001189
fixed NA poly(age, 3, raw = TRUE)3 -0.000001632 0.000006776 -0.2409 3861 0.8097 -0.00001491 0.00001165
fixed NA male 0.02602 0.006028 4.317 3843 0.00001621 0.01421 0.03784
fixed NA sibling_count3 0.000491 0.008668 0.05664 3313 0.9548 -0.0165 0.01748
fixed NA sibling_count4 0.02332 0.01032 2.261 3182 0.02385 0.003102 0.04354
fixed NA sibling_count5 0.03303 0.01308 2.526 3101 0.01159 0.007402 0.05867
fixed NA sibling_count>5 0.0583 0.01491 3.911 3135 0.00009367 0.02909 0.08751
fixed NA birth_order_nonlinear2 0.0002169 0.007492 0.02895 3300 0.9769 -0.01447 0.0149
fixed NA birth_order_nonlinear3 0.001036 0.009708 0.1067 3644 0.915 -0.01799 0.02006
fixed NA birth_order_nonlinear4 -0.01089 0.01288 -0.8453 3728 0.398 -0.03615 0.01436
fixed NA birth_order_nonlinear5 -0.019 0.01726 -1.101 3772 0.271 -0.05282 0.01482
fixed NA birth_order_nonlinear>5 0.001732 0.01775 0.09756 3854 0.9223 -0.03306 0.03653
ran_pars mother_pidlink sd__(Intercept) 0.07048 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.175 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.03478 0.1215 0.2863 3832 0.7747 -0.2034 0.2729
fixed NA poly(age, 3, raw = TRUE)1 -0.003973 0.01469 -0.2706 3836 0.7867 -0.03276 0.02481
fixed NA poly(age, 3, raw = TRUE)2 0.0001861 0.0005623 0.3309 3845 0.7407 -0.000916 0.001288
fixed NA poly(age, 3, raw = TRUE)3 -0.000002854 0.000006796 -0.4199 3853 0.6746 -0.00001617 0.00001047
fixed NA male 0.02537 0.006038 4.202 3832 0.00002704 0.01354 0.0372
fixed NA count_birth_order2/2 0.007706 0.01212 0.6361 3449 0.5248 -0.01604 0.03145
fixed NA count_birth_order1/3 0.004014 0.01111 0.3613 3859 0.7179 -0.01776 0.02579
fixed NA count_birth_order2/3 0.003202 0.01236 0.2591 3862 0.7956 -0.02102 0.02742
fixed NA count_birth_order3/3 0.002463 0.01358 0.1813 3862 0.8561 -0.02416 0.02909
fixed NA count_birth_order1/4 0.03037 0.01504 2.02 3862 0.04345 0.0009027 0.05984
fixed NA count_birth_order2/4 0.02255 0.0155 1.455 3854 0.1457 -0.007823 0.05292
fixed NA count_birth_order3/4 0.0205 0.01592 1.287 3849 0.198 -0.01071 0.05171
fixed NA count_birth_order4/4 0.02008 0.01627 1.234 3859 0.2172 -0.01181 0.05197
fixed NA count_birth_order1/5 0.01887 0.0217 0.8697 3859 0.3845 -0.02365 0.06139
fixed NA count_birth_order2/5 0.03535 0.02463 1.435 3818 0.1513 -0.01292 0.08362
fixed NA count_birth_order3/5 0.03267 0.02251 1.451 3842 0.1468 -0.01145 0.07679
fixed NA count_birth_order4/5 0.02488 0.02104 1.183 3842 0.2369 -0.01634 0.06611
fixed NA count_birth_order5/5 0.03749 0.02189 1.713 3857 0.08683 -0.005409 0.08038
fixed NA count_birth_order1/>5 0.09729 0.02792 3.485 3822 0.0004973 0.04258 0.152
fixed NA count_birth_order2/>5 0.04167 0.02754 1.513 3818 0.1303 -0.01231 0.09565
fixed NA count_birth_order3/>5 0.09556 0.0262 3.647 3808 0.0002685 0.04421 0.1469
fixed NA count_birth_order4/>5 0.03713 0.02435 1.525 3789 0.1273 -0.01058 0.08485
fixed NA count_birth_order5/>5 0.02453 0.0205 1.197 3829 0.2316 -0.01565 0.06472
fixed NA count_birth_order>5/>5 0.06231 0.01387 4.493 3647 0.000007249 0.03513 0.08949
ran_pars mother_pidlink sd__(Intercept) 0.07055 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.175 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -1946 -1877 984.1 -1968 NA NA NA
12 -1945 -1870 984.5 -1969 0.857 1 0.3546
16 -1938 -1838 985.2 -1970 1.428 4 0.8393
26 -1927 -1764 989.3 -1979 8.208 10 0.6085

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Attended School

birthorder <- birthorder %>% mutate(outcome = attended_school)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9681 0.01706 56.76 14640 0 0.9347 1.002
fixed NA poly(age, 3, raw = TRUE)1 0.002032 0.001622 1.253 14591 0.2102 -0.001146 0.00521
fixed NA poly(age, 3, raw = TRUE)2 -0.00002256 0.00004725 -0.4774 14484 0.6331 -0.0001152 0.00007005
fixed NA poly(age, 3, raw = TRUE)3 -0.0000005908 0.0000004301 -1.374 14359 0.1696 -0.000001434 0.0000002522
fixed NA male 0.0045 0.00183 2.459 14526 0.01393 0.0009138 0.008086
fixed NA sibling_count3 -0.0003612 0.00372 -0.09709 11178 0.9227 -0.007653 0.00693
fixed NA sibling_count4 -0.0006508 0.003832 -0.1698 10302 0.8651 -0.008161 0.00686
fixed NA sibling_count5 0.003564 0.004005 0.8899 9432 0.3735 -0.004285 0.01141
fixed NA sibling_count>5 -0.003767 0.003134 -1.202 10431 0.2294 -0.00991 0.002375
ran_pars mother_pidlink sd__(Intercept) 0.04 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1049 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9682 0.01706 56.77 14641 0 0.9348 1.002
fixed NA birth_order 0.0003991 0.0003879 1.029 13583 0.3036 -0.0003612 0.001159
fixed NA poly(age, 3, raw = TRUE)1 0.001915 0.001626 1.178 14583 0.2388 -0.001271 0.005101
fixed NA poly(age, 3, raw = TRUE)2 -0.00001828 0.00004743 -0.3854 14442 0.7 -0.0001113 0.00007469
fixed NA poly(age, 3, raw = TRUE)3 -0.0000006301 0.0000004318 -1.459 14297 0.1445 -0.000001476 0.0000002162
fixed NA male 0.00449 0.00183 2.454 14525 0.01415 0.0009035 0.008076
fixed NA sibling_count3 -0.0004555 0.003722 -0.1224 11194 0.9026 -0.00775 0.006839
fixed NA sibling_count4 -0.0009254 0.003842 -0.2409 10369 0.8096 -0.008455 0.006604
fixed NA sibling_count5 0.003088 0.004032 0.7659 9548 0.4438 -0.004814 0.01099
fixed NA sibling_count>5 -0.005271 0.003458 -1.524 11502 0.1275 -0.01205 0.001507
ran_pars mother_pidlink sd__(Intercept) 0.04003 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1049 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9654 0.0171 56.47 14641 0 0.9319 0.9989
fixed NA poly(age, 3, raw = TRUE)1 0.001958 0.001626 1.204 14586 0.2286 -0.001229 0.005144
fixed NA poly(age, 3, raw = TRUE)2 -0.00002171 0.00004743 -0.4577 14447 0.6472 -0.0001147 0.00007126
fixed NA poly(age, 3, raw = TRUE)3 -0.000000577 0.0000004318 -1.336 14293 0.1815 -0.000001423 0.0000002694
fixed NA male 0.004508 0.001829 2.464 14520 0.01373 0.0009228 0.008093
fixed NA sibling_count3 -0.0008396 0.003773 -0.2226 11526 0.8239 -0.008234 0.006554
fixed NA sibling_count4 -0.001915 0.003947 -0.4851 11041 0.6276 -0.009651 0.005821
fixed NA sibling_count5 0.002337 0.004181 0.5589 10434 0.5762 -0.005858 0.01053
fixed NA sibling_count>5 -0.005684 0.003629 -1.566 12497 0.1174 -0.0128 0.00143
fixed NA birth_order_nonlinear2 0.009478 0.002651 3.576 13546 0.0003508 0.004282 0.01467
fixed NA birth_order_nonlinear3 0.004998 0.00312 1.602 13356 0.1092 -0.001118 0.01111
fixed NA birth_order_nonlinear4 0.00704 0.003569 1.972 13457 0.0486 0.00004392 0.01404
fixed NA birth_order_nonlinear5 0.00423 0.00406 1.042 13457 0.2975 -0.003728 0.01219
fixed NA birth_order_nonlinear>5 0.006468 0.003369 1.92 14708 0.0549 -0.0001353 0.01307
ran_pars mother_pidlink sd__(Intercept) 0.04003 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1049 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9637 0.01717 56.11 14637 0 0.93 0.9973
fixed NA poly(age, 3, raw = TRUE)1 0.001951 0.001626 1.2 14577 0.2303 -0.001236 0.005139
fixed NA poly(age, 3, raw = TRUE)2 -0.00002194 0.00004745 -0.4624 14434 0.6438 -0.0001149 0.00007106
fixed NA poly(age, 3, raw = TRUE)3 -0.0000005714 0.0000004321 -1.322 14273 0.1861 -0.000001418 0.0000002755
fixed NA male 0.004513 0.00183 2.466 14510 0.01367 0.0009264 0.0081
fixed NA count_birth_order2/2 0.01457 0.005155 2.826 13469 0.004716 0.004466 0.02467
fixed NA count_birth_order1/3 0.003496 0.004912 0.7117 14558 0.4767 -0.006132 0.01312
fixed NA count_birth_order2/3 0.006761 0.005492 1.231 14632 0.2184 -0.004004 0.01753
fixed NA count_birth_order3/3 0.006183 0.006121 1.01 14690 0.3125 -0.005814 0.01818
fixed NA count_birth_order1/4 -0.001403 0.00556 -0.2522 14635 0.8009 -0.0123 0.009496
fixed NA count_birth_order2/4 0.00841 0.005915 1.422 14664 0.1552 -0.003185 0.02
fixed NA count_birth_order3/4 0.007888 0.006414 1.23 14703 0.2188 -0.004684 0.02046
fixed NA count_birth_order4/4 0.00767 0.006728 1.14 14715 0.2542 -0.005515 0.02086
fixed NA count_birth_order1/5 0.003475 0.006362 0.5463 14690 0.5849 -0.008993 0.01594
fixed NA count_birth_order2/5 0.0146 0.006711 2.175 14711 0.02966 0.001442 0.02775
fixed NA count_birth_order3/5 0.009876 0.006864 1.439 14717 0.1502 -0.003577 0.02333
fixed NA count_birth_order4/5 0.01004 0.007349 1.367 14725 0.1717 -0.00436 0.02445
fixed NA count_birth_order5/5 0.00893 0.007486 1.193 14725 0.2329 -0.005743 0.0236
fixed NA count_birth_order1/>5 -0.002407 0.005119 -0.4702 14721 0.6382 -0.01244 0.007626
fixed NA count_birth_order2/>5 0.006208 0.005288 1.174 14725 0.2405 -0.004157 0.01657
fixed NA count_birth_order3/>5 -0.0006546 0.005174 -0.1265 14725 0.8993 -0.0108 0.009487
fixed NA count_birth_order4/>5 0.003439 0.005098 0.6747 14725 0.4999 -0.006552 0.01343
fixed NA count_birth_order5/>5 0.0002875 0.005118 0.05618 14725 0.9552 -0.009743 0.01032
fixed NA count_birth_order>5/>5 0.002677 0.00402 0.6661 13473 0.5054 -0.005201 0.01056
ran_pars mother_pidlink sd__(Intercept) 0.04003 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1049 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -22818 -22735 11420 -22840 NA NA NA
12 -22817 -22726 11421 -22841 1.058 1 0.3037
16 -22822 -22701 11427 -22854 12.65 4 0.01311
26 -22805 -22608 11429 -22857 3.176 10 0.977

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.011 0.02852 35.46 6237 4.527e-251 0.9553 1.067
fixed NA poly(age, 3, raw = TRUE)1 -0.001947 0.003235 -0.6018 6237 0.5473 -0.008288 0.004394
fixed NA poly(age, 3, raw = TRUE)2 0.0000824 0.0001155 0.7134 6237 0.4756 -0.000144 0.0003088
fixed NA poly(age, 3, raw = TRUE)3 -0.000001031 0.000001309 -0.7881 6237 0.4307 -0.000003597 0.000001534
fixed NA male 0.0001955 0.001662 0.1176 6237 0.9064 -0.003062 0.003453
fixed NA sibling_count3 -0.0003751 0.002516 -0.1491 6237 0.8815 -0.005307 0.004557
fixed NA sibling_count4 -0.001316 0.002683 -0.4904 6237 0.6238 -0.006575 0.003943
fixed NA sibling_count5 -0.003354 0.003057 -1.097 6237 0.2725 -0.009345 0.002636
fixed NA sibling_count>5 -0.006361 0.002651 -2.399 6237 0.01645 -0.01156 -0.001165
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.0656 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.012 0.02852 35.48 6236 2.299e-251 0.956 1.068
fixed NA birth_order -0.0007748 0.00054 -1.435 6236 0.1514 -0.001833 0.0002837
fixed NA poly(age, 3, raw = TRUE)1 -0.001931 0.003235 -0.5969 6236 0.5506 -0.008272 0.00441
fixed NA poly(age, 3, raw = TRUE)2 0.00008326 0.0001155 0.7209 6236 0.471 -0.0001431 0.0003096
fixed NA poly(age, 3, raw = TRUE)3 -0.00000107 0.000001309 -0.8174 6236 0.4137 -0.000003636 0.000001496
fixed NA male 0.0002228 0.001662 0.1341 6236 0.8933 -0.003034 0.00348
fixed NA sibling_count3 0.00000391 0.00253 0.001546 6236 0.9988 -0.004955 0.004962
fixed NA sibling_count4 -0.0004532 0.002749 -0.1648 6236 0.8691 -0.005842 0.004936
fixed NA sibling_count5 -0.001941 0.003211 -0.6046 6236 0.5455 -0.008235 0.004352
fixed NA sibling_count>5 -0.003485 0.003324 -1.048 6236 0.2945 -0.009999 0.00303
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.0656 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.015 0.02855 35.54 6232 4.212e-252 0.9589 1.071
fixed NA poly(age, 3, raw = TRUE)1 -0.002183 0.003236 -0.6745 6232 0.5 -0.008526 0.00416
fixed NA poly(age, 3, raw = TRUE)2 0.00009152 0.0001155 0.7921 6232 0.4284 -0.0001349 0.000318
fixed NA poly(age, 3, raw = TRUE)3 -0.000001145 0.00000131 -0.8742 6232 0.382 -0.000003712 0.000001422
fixed NA male 0.0001161 0.001662 0.06984 6232 0.9443 -0.003141 0.003373
fixed NA sibling_count3 -0.0003986 0.00259 -0.1539 6232 0.8777 -0.005476 0.004678
fixed NA sibling_count4 -0.00217 0.002874 -0.7549 6232 0.4503 -0.007803 0.003464
fixed NA sibling_count5 -0.00477 0.0034 -1.403 6232 0.1607 -0.01143 0.001894
fixed NA sibling_count>5 -0.006043 0.003442 -1.756 6232 0.07922 -0.01279 0.0007036
fixed NA birth_order_nonlinear2 -0.005037 0.002194 -2.296 6232 0.02171 -0.009336 -0.0007372
fixed NA birth_order_nonlinear3 -0.0001685 0.002691 -0.06262 6232 0.9501 -0.005444 0.005107
fixed NA birth_order_nonlinear4 0.002693 0.003327 0.8095 6232 0.4183 -0.003828 0.009215
fixed NA birth_order_nonlinear5 0.0002744 0.004181 0.06563 6232 0.9477 -0.00792 0.008469
fixed NA birth_order_nonlinear>5 -0.004911 0.00408 -1.204 6232 0.2287 -0.01291 0.003085
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.06558 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.014 0.02858 35.49 6222 2.077e-251 0.9585 1.071
fixed NA poly(age, 3, raw = TRUE)1 -0.00219 0.00324 -0.6758 6222 0.4992 -0.00854 0.00416
fixed NA poly(age, 3, raw = TRUE)2 0.00009155 0.0001157 0.7913 6222 0.4288 -0.0001352 0.0003183
fixed NA poly(age, 3, raw = TRUE)3 -0.000001146 0.000001312 -0.8737 6222 0.3823 -0.000003717 0.000001425
fixed NA male 0.0001459 0.001662 0.08779 6222 0.93 -0.003111 0.003403
fixed NA count_birth_order2/2 -0.003615 0.003935 -0.9188 6222 0.3582 -0.01133 0.004096
fixed NA count_birth_order1/3 -0.0004489 0.003422 -0.1312 6222 0.8956 -0.007157 0.006259
fixed NA count_birth_order2/3 -0.004972 0.003731 -1.333 6222 0.1827 -0.01228 0.00234
fixed NA count_birth_order3/3 0.0009987 0.004173 0.2393 6222 0.8108 -0.00718 0.009177
fixed NA count_birth_order1/4 -0.001972 0.004172 -0.4727 6222 0.6365 -0.01015 0.006204
fixed NA count_birth_order2/4 -0.005412 0.004322 -1.252 6222 0.2105 -0.01388 0.003059
fixed NA count_birth_order3/4 0.000761 0.00458 0.1662 6222 0.868 -0.008216 0.009738
fixed NA count_birth_order4/4 -0.003091 0.004762 -0.6492 6222 0.5163 -0.01242 0.006241
fixed NA count_birth_order1/5 -0.005454 0.005692 -0.9582 6222 0.338 -0.01661 0.005702
fixed NA count_birth_order2/5 -0.02171 0.006134 -3.539 6222 0.0004039 -0.03373 -0.009688
fixed NA count_birth_order3/5 0.0004959 0.00569 0.08716 6222 0.9305 -0.01066 0.01165
fixed NA count_birth_order4/5 0.0006201 0.005594 0.1109 6222 0.9117 -0.01034 0.01158
fixed NA count_birth_order5/5 0.0007406 0.005808 0.1275 6222 0.8985 -0.01064 0.01212
fixed NA count_birth_order1/>5 0.0007324 0.00565 0.1296 6222 0.8969 -0.01034 0.01181
fixed NA count_birth_order2/>5 -0.005395 0.005634 -0.9577 6222 0.3383 -0.01644 0.005647
fixed NA count_birth_order3/>5 -0.01633 0.005546 -2.945 6222 0.003237 -0.0272 -0.005465
fixed NA count_birth_order4/>5 0.0004021 0.005225 0.07696 6222 0.9387 -0.009838 0.01064
fixed NA count_birth_order5/>5 -0.00845 0.005 -1.69 6222 0.09108 -0.01825 0.00135
fixed NA count_birth_order>5/>5 -0.01044 0.003679 -2.838 6222 0.004558 -0.01765 -0.003229
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.06554 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -16291 -16217 8157 -16313 NA NA NA
12 -16291 -16210 8158 -16315 2.061 1 0.1511
16 -16291 -16183 8161 -16323 7.77 4 0.1004
26 -16288 -16113 8170 -16340 16.98 10 0.07483

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.012 0.02829 35.76 6295 4.227e-255 0.9561 1.067
fixed NA poly(age, 3, raw = TRUE)1 -0.001995 0.003211 -0.6213 6295 0.5344 -0.008289 0.004299
fixed NA poly(age, 3, raw = TRUE)2 0.00008284 0.0001147 0.7224 6295 0.4701 -0.0001419 0.0003076
fixed NA poly(age, 3, raw = TRUE)3 -0.000001035 0.0000013 -0.7966 6295 0.4257 -0.000003583 0.000001512
fixed NA male 0.0001628 0.001648 0.09879 6295 0.9213 -0.003067 0.003392
fixed NA sibling_count3 -0.0002068 0.002719 -0.07605 6295 0.9394 -0.005537 0.005123
fixed NA sibling_count4 -0.00003864 0.002839 -0.01361 6295 0.9891 -0.005603 0.005526
fixed NA sibling_count5 -0.001917 0.003027 -0.6333 6295 0.5266 -0.007849 0.004016
fixed NA sibling_count>5 -0.00446 0.002648 -1.684 6295 0.09219 -0.009651 0.0007303
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.06532 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.012 0.02829 35.78 6294 2.301e-255 0.9569 1.068
fixed NA birth_order -0.0006005 0.0004664 -1.288 6294 0.1979 -0.001515 0.0003136
fixed NA poly(age, 3, raw = TRUE)1 -0.002002 0.003211 -0.6233 6294 0.5331 -0.008296 0.004292
fixed NA poly(age, 3, raw = TRUE)2 0.00008416 0.0001147 0.7339 6294 0.463 -0.0001406 0.0003089
fixed NA poly(age, 3, raw = TRUE)3 -0.000001072 0.0000013 -0.8247 6294 0.4096 -0.00000362 0.000001476
fixed NA male 0.000178 0.001648 0.108 6294 0.914 -0.003051 0.003408
fixed NA sibling_count3 0.00008331 0.002729 0.03053 6294 0.9756 -0.005265 0.005431
fixed NA sibling_count4 0.0006008 0.002882 0.2085 6294 0.8349 -0.005048 0.00625
fixed NA sibling_count5 -0.0009089 0.003126 -0.2907 6294 0.7713 -0.007036 0.005218
fixed NA sibling_count>5 -0.002282 0.003142 -0.7263 6294 0.4677 -0.008441 0.003877
ran_pars mother_pidlink sd__(Intercept) 0.000000001071 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.06532 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.015 0.02832 35.85 6290 2.461e-256 0.9599 1.071
fixed NA poly(age, 3, raw = TRUE)1 -0.002241 0.003211 -0.6979 6290 0.4853 -0.008535 0.004053
fixed NA poly(age, 3, raw = TRUE)2 0.00009272 0.0001147 0.8084 6290 0.4189 -0.0001321 0.0003175
fixed NA poly(age, 3, raw = TRUE)3 -0.000001162 0.0000013 -0.8934 6290 0.3717 -0.00000371 0.000001387
fixed NA male 0.00009342 0.001647 0.05671 6290 0.9548 -0.003135 0.003322
fixed NA sibling_count3 -0.0001752 0.002785 -0.06292 6290 0.9498 -0.005633 0.005283
fixed NA sibling_count4 -0.0005815 0.002996 -0.1941 6290 0.8461 -0.006453 0.00529
fixed NA sibling_count5 -0.003249 0.003294 -0.9863 6290 0.324 -0.009706 0.003208
fixed NA sibling_count>5 -0.003948 0.003257 -1.212 6290 0.2254 -0.01033 0.002435
fixed NA birth_order_nonlinear2 -0.005297 0.00222 -2.386 6290 0.01706 -0.009649 -0.000946
fixed NA birth_order_nonlinear3 -0.0005044 0.002664 -0.1893 6290 0.8498 -0.005726 0.004717
fixed NA birth_order_nonlinear4 0.001782 0.003203 0.5562 6290 0.5781 -0.004497 0.00806
fixed NA birth_order_nonlinear5 0.001802 0.003933 0.4582 6290 0.6468 -0.005906 0.00951
fixed NA birth_order_nonlinear>5 -0.005815 0.003619 -1.607 6290 0.1082 -0.01291 0.001278
ran_pars mother_pidlink sd__(Intercept) 0.0000000003181 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.06529 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.015 0.02836 35.79 6280 2.026e-255 0.9593 1.071
fixed NA poly(age, 3, raw = TRUE)1 -0.002231 0.003215 -0.694 6280 0.4877 -0.008532 0.00407
fixed NA poly(age, 3, raw = TRUE)2 0.00009229 0.0001148 0.8037 6280 0.4216 -0.0001328 0.0003174
fixed NA poly(age, 3, raw = TRUE)3 -0.000001156 0.000001302 -0.8876 6280 0.3748 -0.000003708 0.000001396
fixed NA male 0.0001064 0.001648 0.06454 6280 0.9485 -0.003123 0.003336
fixed NA count_birth_order2/2 -0.004276 0.004292 -0.9963 6280 0.3191 -0.01269 0.004136
fixed NA count_birth_order1/3 -0.0003683 0.003692 -0.09976 6280 0.9205 -0.007605 0.006868
fixed NA count_birth_order2/3 -0.00554 0.004017 -1.379 6280 0.168 -0.01341 0.002334
fixed NA count_birth_order3/3 0.001302 0.004497 0.2896 6280 0.7722 -0.007511 0.01012
fixed NA count_birth_order1/4 -0.001762 0.004341 -0.406 6280 0.6848 -0.01027 0.006746
fixed NA count_birth_order2/4 -0.001991 0.004433 -0.4491 6280 0.6534 -0.01068 0.006698
fixed NA count_birth_order3/4 0.0011 0.004877 0.2256 6280 0.8215 -0.008458 0.01066
fixed NA count_birth_order4/4 -0.003243 0.005046 -0.6427 6280 0.5204 -0.01313 0.006647
fixed NA count_birth_order1/5 -0.003534 0.005172 -0.6833 6280 0.4945 -0.01367 0.006603
fixed NA count_birth_order2/5 -0.01611 0.005572 -2.891 6280 0.003849 -0.02703 -0.00519
fixed NA count_birth_order3/5 0.0009379 0.005428 0.1728 6280 0.8628 -0.009702 0.01158
fixed NA count_birth_order4/5 0.001 0.005696 0.1756 6280 0.8606 -0.01016 0.01216
fixed NA count_birth_order5/5 0.001112 0.005673 0.196 6280 0.8446 -0.01001 0.01223
fixed NA count_birth_order1/>5 0.001216 0.00493 0.2466 6280 0.8052 -0.008447 0.01088
fixed NA count_birth_order2/>5 -0.008076 0.005152 -1.568 6280 0.117 -0.01817 0.002021
fixed NA count_birth_order3/>5 -0.01154 0.005022 -2.297 6280 0.02165 -0.02138 -0.001693
fixed NA count_birth_order4/>5 0.0009338 0.004821 0.1937 6280 0.8464 -0.008515 0.01038
fixed NA count_birth_order5/>5 -0.003345 0.00499 -0.6702 6280 0.5028 -0.01313 0.006436
fixed NA count_birth_order>5/>5 -0.009414 0.003609 -2.609 6280 0.00911 -0.01649 -0.002341
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.06528 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -16498 -16423 8260 -16520 NA NA NA
12 -16497 -16416 8261 -16521 1.66 1 0.1976
16 -16499 -16391 8266 -16531 9.831 4 0.04338
26 -16491 -16315 8271 -16543 11.8 10 0.2989

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.018 0.02859 35.61 6115 1.509e-252 0.9619 1.074
fixed NA poly(age, 3, raw = TRUE)1 -0.00255 0.003245 -0.7858 6115 0.432 -0.00891 0.00381
fixed NA poly(age, 3, raw = TRUE)2 0.0001017 0.0001159 0.8777 6115 0.3801 -0.0001254 0.0003288
fixed NA poly(age, 3, raw = TRUE)3 -0.00000123 0.000001314 -0.936 6115 0.3493 -0.000003805 0.000001345
fixed NA male -0.00009463 0.001664 -0.05687 6115 0.9546 -0.003356 0.003167
fixed NA sibling_count3 -0.001208 0.00246 -0.4911 6115 0.6234 -0.006031 0.003614
fixed NA sibling_count4 -0.003839 0.002643 -1.452 6115 0.1464 -0.00902 0.001341
fixed NA sibling_count5 -0.003218 0.003094 -1.04 6115 0.2983 -0.009281 0.002845
fixed NA sibling_count>5 -0.006981 0.002649 -2.636 6115 0.008414 -0.01217 -0.00179
ran_pars mother_pidlink sd__(Intercept) 0.0000000004397 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.06502 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.019 0.02859 35.62 6114 9.457e-253 0.9625 1.075
fixed NA birth_order -0.0006737 0.0005522 -1.22 6114 0.2225 -0.001756 0.0004086
fixed NA poly(age, 3, raw = TRUE)1 -0.002525 0.003245 -0.778 6114 0.4366 -0.008884 0.003835
fixed NA poly(age, 3, raw = TRUE)2 0.0001021 0.0001159 0.8812 6114 0.3782 -0.000125 0.0003292
fixed NA poly(age, 3, raw = TRUE)3 -0.00000126 0.000001314 -0.9586 6114 0.3378 -0.000003835 0.000001316
fixed NA male -0.0000827 0.001664 -0.0497 6114 0.9604 -0.003344 0.003178
fixed NA sibling_count3 -0.0008808 0.002475 -0.3559 6114 0.7219 -0.005732 0.00397
fixed NA sibling_count4 -0.0031 0.002712 -1.143 6114 0.253 -0.008415 0.002215
fixed NA sibling_count5 -0.002043 0.00324 -0.6306 6114 0.5284 -0.008393 0.004307
fixed NA sibling_count>5 -0.004499 0.00334 -1.347 6114 0.178 -0.01104 0.002047
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.06501 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.021 0.02862 35.68 6110 1.688e-253 0.9653 1.077
fixed NA poly(age, 3, raw = TRUE)1 -0.002776 0.003246 -0.8553 6110 0.3924 -0.009138 0.003585
fixed NA poly(age, 3, raw = TRUE)2 0.0001105 0.0001159 0.9533 6110 0.3405 -0.0001167 0.0003377
fixed NA poly(age, 3, raw = TRUE)3 -0.000001342 0.000001315 -1.021 6110 0.3075 -0.000003918 0.000001235
fixed NA male -0.0001589 0.001664 -0.0955 6110 0.9239 -0.00342 0.003102
fixed NA sibling_count3 -0.001365 0.002536 -0.5382 6110 0.5905 -0.006336 0.003606
fixed NA sibling_count4 -0.004754 0.002838 -1.675 6110 0.09402 -0.01032 0.0008094
fixed NA sibling_count5 -0.003792 0.003416 -1.11 6110 0.267 -0.01049 0.002903
fixed NA sibling_count>5 -0.006122 0.003464 -1.768 6110 0.07718 -0.01291 0.0006664
fixed NA birth_order_nonlinear2 -0.004324 0.002171 -1.992 6110 0.04639 -0.008579 -0.0000701
fixed NA birth_order_nonlinear3 0.0001426 0.002671 0.05338 6110 0.9574 -0.005093 0.005378
fixed NA birth_order_nonlinear4 0.00281 0.003394 0.828 6110 0.4077 -0.003842 0.009463
fixed NA birth_order_nonlinear5 -0.004068 0.004315 -0.9426 6110 0.3459 -0.01253 0.00439
fixed NA birth_order_nonlinear>5 -0.004234 0.004176 -1.014 6110 0.3107 -0.01242 0.003951
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.065 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.021 0.02867 35.61 6100 1.551e-252 0.9647 1.077
fixed NA poly(age, 3, raw = TRUE)1 -0.002721 0.003251 -0.8371 6100 0.4026 -0.009092 0.00365
fixed NA poly(age, 3, raw = TRUE)2 0.0001088 0.0001161 0.9369 6100 0.3489 -0.0001188 0.0003363
fixed NA poly(age, 3, raw = TRUE)3 -0.000001325 0.000001317 -1.006 6100 0.3146 -0.000003906 0.000001257
fixed NA male -0.00008317 0.001664 -0.04997 6100 0.9601 -0.003345 0.003179
fixed NA count_birth_order2/2 -0.004503 0.003796 -1.186 6100 0.2356 -0.01194 0.002937
fixed NA count_birth_order1/3 -0.001611 0.003351 -0.4808 6100 0.6307 -0.00818 0.004957
fixed NA count_birth_order2/3 -0.00631 0.0037 -1.705 6100 0.0882 -0.01356 0.0009425
fixed NA count_birth_order3/3 -0.0002261 0.004069 -0.05556 6100 0.9557 -0.0082 0.007748
fixed NA count_birth_order1/4 -0.008884 0.004156 -2.137 6100 0.0326 -0.01703 -0.0007379
fixed NA count_birth_order2/4 -0.006667 0.004294 -1.552 6100 0.1206 -0.01508 0.00175
fixed NA count_birth_order3/4 -0.0003684 0.004503 -0.08182 6100 0.9348 -0.009195 0.008458
fixed NA count_birth_order4/4 -0.004377 0.004758 -0.9199 6100 0.3576 -0.0137 0.004948
fixed NA count_birth_order1/5 -0.0004467 0.005644 -0.07915 6100 0.9369 -0.01151 0.01061
fixed NA count_birth_order2/5 -0.01668 0.006279 -2.656 6100 0.00793 -0.02898 -0.00437
fixed NA count_birth_order3/5 -0.0006599 0.005896 -0.1119 6100 0.9109 -0.01222 0.0109
fixed NA count_birth_order4/5 -0.000488 0.0058 -0.08414 6100 0.9329 -0.01186 0.01088
fixed NA count_birth_order5/5 -0.008039 0.006139 -1.309 6100 0.1904 -0.02007 0.003993
fixed NA count_birth_order1/>5 -0.0002868 0.005746 -0.04992 6100 0.9602 -0.01155 0.01097
fixed NA count_birth_order2/>5 -0.006855 0.005725 -1.197 6100 0.2312 -0.01808 0.004366
fixed NA count_birth_order3/>5 -0.01792 0.005558 -3.225 6100 0.001268 -0.02882 -0.007029
fixed NA count_birth_order4/>5 -0.0006839 0.005444 -0.1256 6100 0.9 -0.01135 0.009987
fixed NA count_birth_order5/>5 -0.0102 0.005072 -2.011 6100 0.04438 -0.02014 -0.0002581
fixed NA count_birth_order>5/>5 -0.01043 0.003711 -2.812 6100 0.004944 -0.01771 -0.00316
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.06498 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -16083 -16009 8052 -16105 NA NA NA
12 -16082 -16002 8053 -16106 1.491 1 0.2221
16 -16081 -15974 8057 -16113 6.603 4 0.1584
26 -16075 -15901 8064 -16127 14.38 10 0.1565

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Work

Income Last Month (log) - z-standardized

birthorder <- birthorder %>% mutate(outcome = wage_last_month_z)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.166 0.3787 -5.72 5937 0.00000001118 -2.909 -1.424
fixed NA poly(age, 3, raw = TRUE)1 0.1631 0.03571 4.567 5923 0.00000505 0.09308 0.233
fixed NA poly(age, 3, raw = TRUE)2 -0.003976 0.001063 -3.739 5911 0.0001865 -0.00606 -0.001892
fixed NA poly(age, 3, raw = TRUE)3 0.00003055 0.00001006 3.036 5906 0.002407 0.00001083 0.00005027
fixed NA male 0.1388 0.02631 5.276 5982 0.0000001363 0.08727 0.1904
fixed NA sibling_count3 0.1019 0.05214 1.954 4767 0.05082 -0.0003369 0.204
fixed NA sibling_count4 0.05405 0.05208 1.038 4546 0.2994 -0.04802 0.1561
fixed NA sibling_count5 0.05158 0.05423 0.9512 4306 0.3415 -0.0547 0.1579
fixed NA sibling_count>5 -0.003651 0.04276 -0.08539 4670 0.932 -0.08745 0.08015
ran_pars mother_pidlink sd__(Intercept) 0.2708 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.95 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.15 0.3789 -5.675 5935 0.00000001457 -2.892 -1.407
fixed NA birth_order 0.007971 0.005175 1.54 4824 0.1235 -0.002171 0.01811
fixed NA poly(age, 3, raw = TRUE)1 0.1595 0.03578 4.457 5913 0.000008464 0.08934 0.2296
fixed NA poly(age, 3, raw = TRUE)2 -0.003854 0.001066 -3.615 5893 0.0003034 -0.005943 -0.001764
fixed NA poly(age, 3, raw = TRUE)3 0.0000294 0.00001009 2.914 5885 0.003576 0.000009629 0.00004917
fixed NA male 0.1384 0.02631 5.26 5981 0.0000001487 0.08684 0.19
fixed NA sibling_count3 0.0995 0.05217 1.907 4769 0.05654 -0.002746 0.2017
fixed NA sibling_count4 0.04798 0.05223 0.9185 4568 0.3584 -0.0544 0.1504
fixed NA sibling_count5 0.04152 0.05463 0.7601 4344 0.4472 -0.06554 0.1486
fixed NA sibling_count>5 -0.03363 0.04698 -0.7158 4986 0.4741 -0.1257 0.05845
ran_pars mother_pidlink sd__(Intercept) 0.2729 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9493 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.148 0.3795 -5.66 5928 0.00000001586 -2.892 -1.404
fixed NA poly(age, 3, raw = TRUE)1 0.1602 0.03579 4.475 5909 0.000007783 0.09002 0.2303
fixed NA poly(age, 3, raw = TRUE)2 -0.003894 0.001067 -3.65 5888 0.0002643 -0.005985 -0.001803
fixed NA poly(age, 3, raw = TRUE)3 0.00002995 0.0000101 2.965 5877 0.003036 0.00001015 0.00004975
fixed NA male 0.1388 0.02631 5.274 5977 0.0000001381 0.08721 0.1904
fixed NA sibling_count3 0.09578 0.05293 1.809 4894 0.07044 -0.007966 0.1995
fixed NA sibling_count4 0.03642 0.05393 0.6753 4841 0.4995 -0.06928 0.1421
fixed NA sibling_count5 0.01732 0.05692 0.3043 4717 0.7609 -0.09424 0.1289
fixed NA sibling_count>5 -0.04504 0.0495 -0.9098 5352 0.3629 -0.1421 0.05198
fixed NA birth_order_nonlinear2 0.02294 0.03805 0.6028 5545 0.5467 -0.05164 0.09751
fixed NA birth_order_nonlinear3 0.03579 0.04407 0.8122 5531 0.4167 -0.05058 0.1222
fixed NA birth_order_nonlinear4 0.07121 0.04928 1.445 5595 0.1485 -0.02536 0.1678
fixed NA birth_order_nonlinear5 0.1192 0.05594 2.131 5583 0.03312 0.009575 0.2288
fixed NA birth_order_nonlinear>5 0.0531 0.04599 1.155 5960 0.2483 -0.03705 0.1432
ran_pars mother_pidlink sd__(Intercept) 0.2737 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9492 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.12 0.3809 -5.565 5920 0.0000000274 -2.866 -1.373
fixed NA poly(age, 3, raw = TRUE)1 0.1581 0.03585 4.409 5898 0.00001057 0.0878 0.2283
fixed NA poly(age, 3, raw = TRUE)2 -0.00382 0.001069 -3.574 5875 0.0003546 -0.005915 -0.001725
fixed NA poly(age, 3, raw = TRUE)3 0.00002915 0.00001012 2.88 5862 0.003988 0.000009315 0.00004899
fixed NA male 0.1379 0.02635 5.235 5967 0.0000001702 0.0863 0.1896
fixed NA count_birth_order2/2 -0.006871 0.07714 -0.08907 5560 0.929 -0.1581 0.1443
fixed NA count_birth_order1/3 0.1024 0.06942 1.475 5953 0.1403 -0.03367 0.2384
fixed NA count_birth_order2/3 0.08335 0.0791 1.054 5964 0.292 -0.07168 0.2384
fixed NA count_birth_order3/3 0.1205 0.08859 1.361 5968 0.1737 -0.05309 0.2942
fixed NA count_birth_order1/4 0.06485 0.07708 0.8413 5962 0.4002 -0.08622 0.2159
fixed NA count_birth_order2/4 0.08698 0.08249 1.054 5964 0.2917 -0.0747 0.2487
fixed NA count_birth_order3/4 -0.04521 0.08657 -0.5222 5967 0.6016 -0.2149 0.1245
fixed NA count_birth_order4/4 0.108 0.09454 1.142 5968 0.2535 -0.07732 0.2933
fixed NA count_birth_order1/5 -0.03409 0.08715 -0.3912 5966 0.6956 -0.2049 0.1367
fixed NA count_birth_order2/5 0.1125 0.09623 1.169 5967 0.2425 -0.07613 0.3011
fixed NA count_birth_order3/5 0.05178 0.09796 0.5285 5967 0.5971 -0.1402 0.2438
fixed NA count_birth_order4/5 0.03552 0.09973 0.3561 5964 0.7218 -0.1599 0.231
fixed NA count_birth_order5/5 0.1267 0.1031 1.229 5966 0.2192 -0.07539 0.3288
fixed NA count_birth_order1/>5 -0.09157 0.06947 -1.318 5968 0.1875 -0.2277 0.04459
fixed NA count_birth_order2/>5 -0.06085 0.07256 -0.8386 5966 0.4017 -0.2031 0.08136
fixed NA count_birth_order3/>5 0.0349 0.07161 0.4874 5965 0.626 -0.1055 0.1753
fixed NA count_birth_order4/>5 0.02553 0.06944 0.3677 5968 0.7131 -0.1106 0.1616
fixed NA count_birth_order5/>5 0.06345 0.07022 0.9035 5965 0.3663 -0.07419 0.2011
fixed NA count_birth_order>5/>5 -0.002149 0.05532 -0.03884 5572 0.969 -0.1106 0.1063
ran_pars mother_pidlink sd__(Intercept) 0.2764 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9487 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16856 16930 -8417 16834 NA NA NA
12 16856 16936 -8416 16832 2.37 1 0.1237
16 16861 16968 -8415 16829 2.788 4 0.5939
26 16875 17049 -8411 16823 6.743 10 0.7495

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.967 0.8516 -3.484 2520 0.0005031 -4.636 -1.298
fixed NA poly(age, 3, raw = TRUE)1 0.24 0.09033 2.656 2522 0.007946 0.06292 0.417
fixed NA poly(age, 3, raw = TRUE)2 -0.00612 0.003071 -1.993 2524 0.0464 -0.01214 -0.0001006
fixed NA poly(age, 3, raw = TRUE)3 0.00005134 0.00003351 1.532 2526 0.1256 -0.00001433 0.000117
fixed NA male 0.1734 0.03918 4.426 2528 0.00001003 0.09659 0.2502
fixed NA sibling_count3 0.05539 0.06069 0.9127 2127 0.3615 -0.06356 0.1743
fixed NA sibling_count4 -0.05519 0.06241 -0.8843 1977 0.3766 -0.1775 0.06713
fixed NA sibling_count5 -0.1223 0.07112 -1.72 1841 0.08567 -0.2617 0.01709
fixed NA sibling_count>5 -0.1055 0.06141 -1.718 1733 0.08605 -0.2258 0.01488
ran_pars mother_pidlink sd__(Intercept) 0.1431 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9554 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.949 0.851 -3.465 2520 0.0005386 -4.617 -1.281
fixed NA birth_order 0.02897 0.01228 2.359 2271 0.01839 0.004905 0.05304
fixed NA poly(age, 3, raw = TRUE)1 0.2348 0.09028 2.601 2521 0.009363 0.05783 0.4117
fixed NA poly(age, 3, raw = TRUE)2 -0.005999 0.003069 -1.955 2523 0.05071 -0.01201 0.0000156
fixed NA poly(age, 3, raw = TRUE)3 0.00005109 0.00003348 1.526 2525 0.1272 -0.00001453 0.0001167
fixed NA male 0.1711 0.03915 4.371 2528 0.00001286 0.09441 0.2479
fixed NA sibling_count3 0.04128 0.06096 0.6772 2126 0.4983 -0.07819 0.1608
fixed NA sibling_count4 -0.08726 0.06386 -1.367 1980 0.1719 -0.2124 0.03789
fixed NA sibling_count5 -0.1757 0.07463 -2.355 1843 0.01865 -0.322 -0.02945
fixed NA sibling_count>5 -0.2097 0.07565 -2.772 1785 0.005637 -0.3579 -0.0614
ran_pars mother_pidlink sd__(Intercept) 0.1526 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9531 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.933 0.8519 -3.443 2516 0.0005837 -4.603 -1.264
fixed NA poly(age, 3, raw = TRUE)1 0.2365 0.09037 2.617 2518 0.008922 0.05938 0.4136
fixed NA poly(age, 3, raw = TRUE)2 -0.006059 0.003072 -1.972 2520 0.04867 -0.01208 -0.00003838
fixed NA poly(age, 3, raw = TRUE)3 0.0000517 0.00003351 1.543 2522 0.123 -0.00001399 0.0001174
fixed NA male 0.1724 0.03916 4.402 2524 0.00001117 0.09565 0.2492
fixed NA sibling_count3 0.02577 0.06226 0.4139 2185 0.679 -0.09625 0.1478
fixed NA sibling_count4 -0.1117 0.06659 -1.678 2118 0.09355 -0.2422 0.01879
fixed NA sibling_count5 -0.1958 0.07894 -2.48 2016 0.01321 -0.3505 -0.04107
fixed NA sibling_count>5 -0.2197 0.07809 -2.813 1897 0.004958 -0.3727 -0.06662
fixed NA birth_order_nonlinear2 0.02232 0.05137 0.4345 2297 0.664 -0.07837 0.123
fixed NA birth_order_nonlinear3 0.1267 0.06161 2.057 2378 0.03981 0.005969 0.2475
fixed NA birth_order_nonlinear4 0.1321 0.07471 1.769 2427 0.07707 -0.01429 0.2786
fixed NA birth_order_nonlinear5 0.0958 0.09391 1.02 2472 0.3078 -0.08827 0.2799
fixed NA birth_order_nonlinear>5 0.1847 0.09213 2.004 2440 0.04515 0.004083 0.3652
ran_pars mother_pidlink sd__(Intercept) 0.1585 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9525 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.924 0.8537 -3.424 2506 0.000626 -4.597 -1.25
fixed NA poly(age, 3, raw = TRUE)1 0.2359 0.09068 2.601 2508 0.009348 0.05814 0.4136
fixed NA poly(age, 3, raw = TRUE)2 -0.006003 0.003083 -1.947 2510 0.05162 -0.01205 0.00003935
fixed NA poly(age, 3, raw = TRUE)3 0.00005074 0.00003364 1.508 2512 0.1316 -0.00001519 0.0001167
fixed NA male 0.1682 0.03928 4.281 2515 0.00001927 0.09118 0.2451
fixed NA count_birth_order2/2 -0.01186 0.09694 -0.1223 2306 0.9027 -0.2019 0.1781
fixed NA count_birth_order1/3 0.002427 0.08014 0.03029 2517 0.9758 -0.1546 0.1595
fixed NA count_birth_order2/3 0.08795 0.09083 0.9683 2517 0.333 -0.09007 0.266
fixed NA count_birth_order3/3 0.09969 0.1004 0.9929 2516 0.3208 -0.09709 0.2965
fixed NA count_birth_order1/4 -0.193 0.09389 -2.056 2517 0.03989 -0.3771 -0.009012
fixed NA count_birth_order2/4 -0.03204 0.09714 -0.3299 2517 0.7415 -0.2224 0.1584
fixed NA count_birth_order3/4 0.05193 0.1026 0.5059 2516 0.6129 -0.1492 0.2531
fixed NA count_birth_order4/4 -0.03512 0.11 -0.3193 2516 0.7495 -0.2507 0.1805
fixed NA count_birth_order1/5 -0.0734 0.127 -0.5779 2517 0.5634 -0.3223 0.1755
fixed NA count_birth_order2/5 -0.2006 0.1483 -1.353 2516 0.1762 -0.4913 0.09001
fixed NA count_birth_order3/5 -0.1334 0.1329 -1.003 2517 0.3158 -0.3939 0.1272
fixed NA count_birth_order4/5 -0.06657 0.1264 -0.5265 2516 0.5986 -0.3144 0.1812
fixed NA count_birth_order5/5 -0.2006 0.1302 -1.54 2516 0.1236 -0.4559 0.05465
fixed NA count_birth_order1/>5 -0.204 0.1252 -1.629 2514 0.1034 -0.4494 0.0414
fixed NA count_birth_order2/>5 -0.4087 0.1263 -3.236 2516 0.001229 -0.6563 -0.1611
fixed NA count_birth_order3/>5 -0.06434 0.1266 -0.5081 2517 0.6115 -0.3125 0.1839
fixed NA count_birth_order4/>5 -0.05434 0.1165 -0.4663 2517 0.641 -0.2828 0.1741
fixed NA count_birth_order5/>5 -0.07096 0.1149 -0.6177 2516 0.5368 -0.2961 0.1542
fixed NA count_birth_order>5/>5 -0.04591 0.08527 -0.5384 2356 0.5904 -0.213 0.1212
ran_pars mother_pidlink sd__(Intercept) 0.1652 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9515 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 7048 7112 -3513 7026 NA NA NA
12 7045 7115 -3510 7021 5.566 1 0.01831
16 7051 7144 -3509 7019 1.971 4 0.741
26 7061 7213 -3505 7009 9.311 10 0.5029

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.021 0.8508 -3.551 2536 0.0003903 -4.689 -1.354
fixed NA poly(age, 3, raw = TRUE)1 0.2478 0.09033 2.744 2537 0.006121 0.07078 0.4249
fixed NA poly(age, 3, raw = TRUE)2 -0.006428 0.003071 -2.093 2540 0.03643 -0.01245 -0.0004093
fixed NA poly(age, 3, raw = TRUE)3 0.00005481 0.00003351 1.636 2541 0.102 -0.00001086 0.0001205
fixed NA male 0.1666 0.03915 4.256 2545 0.00002155 0.08989 0.2433
fixed NA sibling_count3 0.03445 0.06704 0.5139 2194 0.6074 -0.09694 0.1658
fixed NA sibling_count4 0.00218 0.06772 0.03219 2086 0.9743 -0.1305 0.1349
fixed NA sibling_count5 -0.1056 0.0713 -1.481 1944 0.1387 -0.2454 0.03414
fixed NA sibling_count>5 -0.08992 0.06331 -1.42 2003 0.1557 -0.214 0.03417
ran_pars mother_pidlink sd__(Intercept) 0.1499 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9564 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.016 0.8506 -3.546 2535 0.0003985 -4.683 -1.349
fixed NA birth_order 0.01776 0.01074 1.653 2211 0.09839 -0.003294 0.03882
fixed NA poly(age, 3, raw = TRUE)1 0.2451 0.09032 2.714 2537 0.006698 0.06808 0.4221
fixed NA poly(age, 3, raw = TRUE)2 -0.006365 0.00307 -2.073 2539 0.03828 -0.01238 -0.0003467
fixed NA poly(age, 3, raw = TRUE)3 0.00005472 0.0000335 1.633 2541 0.1025 -0.00001094 0.0001204
fixed NA male 0.1651 0.03914 4.218 2544 0.00002552 0.08839 0.2418
fixed NA sibling_count3 0.0256 0.06726 0.3806 2191 0.7036 -0.1062 0.1574
fixed NA sibling_count4 -0.01668 0.06869 -0.2428 2080 0.8082 -0.1513 0.118
fixed NA sibling_count5 -0.1356 0.07361 -1.842 1940 0.06558 -0.2799 0.00866
fixed NA sibling_count>5 -0.1524 0.07377 -2.066 1993 0.039 -0.297 -0.007788
ran_pars mother_pidlink sd__(Intercept) 0.1605 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9544 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.025 0.8511 -3.555 2531 0.0003854 -4.693 -1.357
fixed NA poly(age, 3, raw = TRUE)1 0.247 0.09037 2.733 2533 0.006314 0.06989 0.4241
fixed NA poly(age, 3, raw = TRUE)2 -0.006441 0.003072 -2.097 2536 0.03612 -0.01246 -0.00042
fixed NA poly(age, 3, raw = TRUE)3 0.00005564 0.00003352 1.66 2538 0.09702 -0.00001005 0.0001213
fixed NA male 0.1661 0.03914 4.244 2541 0.00002278 0.08938 0.2428
fixed NA sibling_count3 0.005788 0.06854 0.08445 2232 0.9327 -0.1285 0.1401
fixed NA sibling_count4 -0.05279 0.07109 -0.7426 2178 0.4578 -0.1921 0.08654
fixed NA sibling_count5 -0.167 0.07725 -2.161 2080 0.03079 -0.3184 -0.01555
fixed NA sibling_count>5 -0.1714 0.07608 -2.254 2088 0.02433 -0.3206 -0.02234
fixed NA birth_order_nonlinear2 0.05834 0.0521 1.12 2328 0.263 -0.04379 0.1605
fixed NA birth_order_nonlinear3 0.1224 0.06201 1.974 2428 0.04852 0.0008591 0.2439
fixed NA birth_order_nonlinear4 0.1577 0.07258 2.173 2452 0.02989 0.01544 0.2999
fixed NA birth_order_nonlinear5 0.07475 0.08919 0.8381 2485 0.4021 -0.1001 0.2496
fixed NA birth_order_nonlinear>5 0.1222 0.08292 1.473 2441 0.1409 -0.04038 0.2847
ran_pars mother_pidlink sd__(Intercept) 0.1634 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9539 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.005 0.8535 -3.521 2521 0.0004373 -4.678 -1.333
fixed NA poly(age, 3, raw = TRUE)1 0.2466 0.09072 2.718 2523 0.006617 0.06875 0.4244
fixed NA poly(age, 3, raw = TRUE)2 -0.006401 0.003084 -2.075 2525 0.03805 -0.01245 -0.0003561
fixed NA poly(age, 3, raw = TRUE)3 0.00005498 0.00003365 1.634 2527 0.1024 -0.00001098 0.0001209
fixed NA male 0.1643 0.03928 4.183 2531 0.00002976 0.08731 0.2413
fixed NA count_birth_order2/2 -0.01229 0.1097 -0.112 2369 0.9108 -0.2272 0.2027
fixed NA count_birth_order1/3 -0.03131 0.08855 -0.3535 2533 0.7237 -0.2049 0.1422
fixed NA count_birth_order2/3 0.1016 0.09821 1.035 2533 0.3009 -0.09088 0.2941
fixed NA count_birth_order3/3 0.054 0.1103 0.4897 2533 0.6244 -0.1621 0.2702
fixed NA count_birth_order1/4 -0.1062 0.09942 -1.068 2533 0.2857 -0.301 0.0887
fixed NA count_birth_order2/4 0.06707 0.1002 0.6692 2533 0.5034 -0.1294 0.2635
fixed NA count_birth_order3/4 0.02235 0.1126 0.1984 2533 0.8427 -0.1984 0.2431
fixed NA count_birth_order4/4 0.02293 0.1206 0.19 2532 0.8493 -0.2135 0.2594
fixed NA count_birth_order1/5 -0.1291 0.116 -1.113 2533 0.2659 -0.3564 0.09827
fixed NA count_birth_order2/5 -0.1532 0.1278 -1.199 2532 0.2307 -0.4036 0.09726
fixed NA count_birth_order3/5 -0.05305 0.1277 -0.4155 2532 0.6778 -0.3033 0.1972
fixed NA count_birth_order4/5 -0.03084 0.1287 -0.2395 2531 0.8107 -0.2832 0.2215
fixed NA count_birth_order5/5 -0.1853 0.1282 -1.446 2532 0.1484 -0.4366 0.06595
fixed NA count_birth_order1/>5 -0.2191 0.1105 -1.984 2530 0.04737 -0.4356 -0.002651
fixed NA count_birth_order2/>5 -0.2885 0.1175 -2.456 2532 0.01411 -0.5188 -0.05829
fixed NA count_birth_order3/>5 0.006948 0.1182 0.05879 2533 0.9531 -0.2247 0.2386
fixed NA count_birth_order4/>5 0.008072 0.1093 0.07383 2533 0.9411 -0.2062 0.2223
fixed NA count_birth_order5/>5 -0.06426 0.1169 -0.5495 2531 0.5827 -0.2935 0.165
fixed NA count_birth_order>5/>5 -0.07115 0.08545 -0.8326 2414 0.4051 -0.2386 0.09633
ran_pars mother_pidlink sd__(Intercept) 0.1732 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9527 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 7103 7167 -3541 7081 NA NA NA
12 7102 7173 -3539 7078 2.723 1 0.0989
16 7106 7200 -3537 7074 3.99 4 0.4074
26 7119 7271 -3533 7067 7.706 10 0.6575

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.95 0.8647 -3.411 2471 0.0006572 -4.644 -1.255
fixed NA poly(age, 3, raw = TRUE)1 0.2362 0.09172 2.575 2473 0.01007 0.05644 0.416
fixed NA poly(age, 3, raw = TRUE)2 -0.005959 0.003116 -1.912 2475 0.05597 -0.01207 0.000149
fixed NA poly(age, 3, raw = TRUE)3 0.00004927 0.00003398 1.45 2477 0.1472 -0.00001733 0.0001159
fixed NA male 0.1752 0.03992 4.388 2480 0.00001193 0.09692 0.2534
fixed NA sibling_count3 0.04336 0.06038 0.7181 2078 0.4728 -0.07499 0.1617
fixed NA sibling_count4 -0.08107 0.06277 -1.292 1918 0.1967 -0.2041 0.04196
fixed NA sibling_count5 -0.09708 0.07355 -1.32 1726 0.187 -0.2412 0.04707
fixed NA sibling_count>5 -0.08266 0.06241 -1.324 1639 0.1855 -0.205 0.03966
ran_pars mother_pidlink sd__(Intercept) 0.15 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9632 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.931 0.8643 -3.391 2470 0.0007075 -4.625 -1.237
fixed NA birth_order 0.02467 0.01273 1.938 2248 0.05277 -0.0002824 0.04963
fixed NA poly(age, 3, raw = TRUE)1 0.2313 0.09171 2.523 2471 0.01171 0.0516 0.4111
fixed NA poly(age, 3, raw = TRUE)2 -0.005839 0.003115 -1.874 2474 0.061 -0.01195 0.0002667
fixed NA poly(age, 3, raw = TRUE)3 0.00004885 0.00003396 1.438 2476 0.1505 -0.00001772 0.0001154
fixed NA male 0.1739 0.03991 4.357 2480 0.0000137 0.09568 0.2521
fixed NA sibling_count3 0.03093 0.06071 0.5095 2075 0.6105 -0.08806 0.1499
fixed NA sibling_count4 -0.108 0.06429 -1.68 1925 0.09304 -0.234 0.01797
fixed NA sibling_count5 -0.1412 0.07701 -1.834 1734 0.06688 -0.2921 0.009731
fixed NA sibling_count>5 -0.1711 0.07736 -2.212 1731 0.02708 -0.3228 -0.01952
ran_pars mother_pidlink sd__(Intercept) 0.1571 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9616 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.945 0.8651 -3.404 2466 0.0006738 -4.641 -1.25
fixed NA poly(age, 3, raw = TRUE)1 0.2361 0.09179 2.573 2468 0.01015 0.05623 0.416
fixed NA poly(age, 3, raw = TRUE)2 -0.006009 0.003118 -1.927 2470 0.05408 -0.01212 0.0001024
fixed NA poly(age, 3, raw = TRUE)3 0.0000507 0.000034 1.491 2473 0.136 -0.00001593 0.0001173
fixed NA male 0.1757 0.03993 4.402 2476 0.00001119 0.09749 0.254
fixed NA sibling_count3 0.009872 0.06207 0.159 2135 0.8737 -0.1118 0.1315
fixed NA sibling_count4 -0.1259 0.06698 -1.88 2064 0.06029 -0.2572 0.005376
fixed NA sibling_count5 -0.1521 0.08111 -1.875 1911 0.0609 -0.3111 0.006863
fixed NA sibling_count>5 -0.1838 0.07992 -2.3 1849 0.02158 -0.3404 -0.02714
fixed NA birth_order_nonlinear2 0.01217 0.05179 0.235 2249 0.8142 -0.08934 0.1137
fixed NA birth_order_nonlinear3 0.1384 0.0622 2.225 2331 0.02614 0.01651 0.2603
fixed NA birth_order_nonlinear4 0.05726 0.07794 0.7346 2369 0.4626 -0.0955 0.21
fixed NA birth_order_nonlinear5 0.07804 0.09835 0.7935 2397 0.4276 -0.1147 0.2708
fixed NA birth_order_nonlinear>5 0.1773 0.09559 1.855 2387 0.0637 -0.01002 0.3647
ran_pars mother_pidlink sd__(Intercept) 0.1621 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9608 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.969 0.8669 -3.426 2456 0.0006237 -4.668 -1.27
fixed NA poly(age, 3, raw = TRUE)1 0.2408 0.09211 2.615 2458 0.008989 0.06029 0.4214
fixed NA poly(age, 3, raw = TRUE)2 -0.006135 0.003129 -1.96 2460 0.05006 -0.01227 -0.000001385
fixed NA poly(age, 3, raw = TRUE)3 0.00005172 0.00003412 1.516 2462 0.1298 -0.00001516 0.0001186
fixed NA male 0.1726 0.04006 4.308 2466 0.00001712 0.09407 0.2511
fixed NA count_birth_order2/2 -0.07046 0.09561 -0.7369 2240 0.4613 -0.2579 0.1169
fixed NA count_birth_order1/3 -0.04347 0.08004 -0.5431 2467 0.5871 -0.2003 0.1134
fixed NA count_birth_order2/3 0.06615 0.09109 0.7262 2468 0.4678 -0.1124 0.2447
fixed NA count_birth_order3/3 0.08534 0.09871 0.8646 2466 0.3874 -0.1081 0.2788
fixed NA count_birth_order1/4 -0.2178 0.09523 -2.287 2468 0.0223 -0.4044 -0.03111
fixed NA count_birth_order2/4 -0.0797 0.09775 -0.8153 2468 0.415 -0.2713 0.1119
fixed NA count_birth_order3/4 0.04818 0.1035 0.4657 2468 0.6415 -0.1546 0.251
fixed NA count_birth_order4/4 -0.1601 0.1133 -1.414 2467 0.1575 -0.3821 0.06185
fixed NA count_birth_order1/5 -0.08318 0.1309 -0.6352 2468 0.5253 -0.3398 0.1735
fixed NA count_birth_order2/5 -0.1651 0.1522 -1.085 2468 0.2782 -0.4634 0.1332
fixed NA count_birth_order3/5 -0.09123 0.1405 -0.6492 2468 0.5163 -0.3667 0.1842
fixed NA count_birth_order4/5 -0.1192 0.1345 -0.8861 2467 0.3756 -0.3827 0.1444
fixed NA count_birth_order5/5 -0.1676 0.1392 -1.204 2467 0.2288 -0.4405 0.1053
fixed NA count_birth_order1/>5 -0.1719 0.1281 -1.342 2465 0.1799 -0.4229 0.07922
fixed NA count_birth_order2/>5 -0.3917 0.1323 -2.961 2468 0.003096 -0.6509 -0.1324
fixed NA count_birth_order3/>5 -0.06893 0.1285 -0.5364 2468 0.5917 -0.3208 0.1829
fixed NA count_birth_order4/>5 -0.07846 0.1223 -0.6416 2467 0.5212 -0.3181 0.1612
fixed NA count_birth_order5/>5 -0.08894 0.1182 -0.7525 2467 0.4518 -0.3206 0.1427
fixed NA count_birth_order>5/>5 -0.03323 0.08726 -0.3809 2282 0.7033 -0.2042 0.1378
ran_pars mother_pidlink sd__(Intercept) 0.1651 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9606 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 6958 7022 -3468 6936 NA NA NA
12 6956 7026 -3466 6932 3.756 1 0.05262
16 6960 7053 -3464 6928 3.587 4 0.4648
26 6971 7123 -3460 6919 8.955 10 0.5364

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Income last year (log) - z-standardized

birthorder <- birthorder %>% mutate(outcome = wage_last_year_z)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.932 0.3808 -10.33 5912 8.56e-25 -4.679 -3.186
fixed NA poly(age, 3, raw = TRUE)1 0.3021 0.03594 8.408 5904 5.174e-17 0.2317 0.3726
fixed NA poly(age, 3, raw = TRUE)2 -0.007364 0.001071 -6.873 5897 6.923e-12 -0.009464 -0.005264
fixed NA poly(age, 3, raw = TRUE)3 0.00005769 0.00001015 5.683 5892 0.00000001388 0.00003779 0.00007758
fixed NA male 0.1267 0.02642 4.798 5923 0.000001641 0.07497 0.1785
fixed NA sibling_count3 0.0766 0.05286 1.449 4789 0.1474 -0.02701 0.1802
fixed NA sibling_count4 0.04296 0.05286 0.8128 4611 0.4164 -0.06064 0.1466
fixed NA sibling_count5 0.03471 0.05503 0.6307 4424 0.5282 -0.07315 0.1426
fixed NA sibling_count>5 -0.04989 0.04336 -1.151 4726 0.2499 -0.1349 0.03509
ran_pars mother_pidlink sd__(Intercept) 0.341 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9299 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.925 0.3809 -10.3 5910 1.092e-24 -4.672 -3.179
fixed NA birth_order 0.003522 0.005228 0.6737 5269 0.5005 -0.006725 0.01377
fixed NA poly(age, 3, raw = TRUE)1 0.3005 0.03602 8.344 5897 8.887e-17 0.2299 0.3711
fixed NA poly(age, 3, raw = TRUE)2 -0.007309 0.001075 -6.801 5882 0.00000000001145 -0.009415 -0.005202
fixed NA poly(age, 3, raw = TRUE)3 0.00005716 0.00001018 5.614 5875 0.00000002067 0.00003721 0.00007712
fixed NA male 0.1265 0.02642 4.789 5922 0.000001716 0.07475 0.1783
fixed NA sibling_count3 0.07559 0.05289 1.429 4793 0.153 -0.02807 0.1793
fixed NA sibling_count4 0.0403 0.05301 0.7601 4635 0.4472 -0.06361 0.1442
fixed NA sibling_count5 0.03033 0.05542 0.5472 4465 0.5842 -0.07829 0.139
fixed NA sibling_count>5 -0.06306 0.04756 -1.326 5053 0.1849 -0.1563 0.03016
ran_pars mother_pidlink sd__(Intercept) 0.3417 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9298 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.911 0.3816 -10.25 5903 1.929e-24 -4.659 -3.163
fixed NA poly(age, 3, raw = TRUE)1 0.3 0.03603 8.327 5892 1.021e-16 0.2294 0.3707
fixed NA poly(age, 3, raw = TRUE)2 -0.007284 0.001075 -6.773 5876 0.00000000001386 -0.009392 -0.005176
fixed NA poly(age, 3, raw = TRUE)3 0.00005682 0.0000102 5.573 5867 0.00000002613 0.00003684 0.0000768
fixed NA male 0.1269 0.02642 4.801 5919 0.000001614 0.07508 0.1787
fixed NA sibling_count3 0.08191 0.05362 1.528 4907 0.1267 -0.02318 0.187
fixed NA sibling_count4 0.04998 0.05468 0.9141 4884 0.3607 -0.05719 0.1572
fixed NA sibling_count5 0.02631 0.05763 0.4565 4795 0.6481 -0.08664 0.1393
fixed NA sibling_count>5 -0.06185 0.05001 -1.237 5369 0.2162 -0.1599 0.03617
fixed NA birth_order_nonlinear2 -0.0194 0.03805 -0.5098 5505 0.6102 -0.09398 0.05518
fixed NA birth_order_nonlinear3 -0.0268 0.04408 -0.608 5472 0.5432 -0.1132 0.0596
fixed NA birth_order_nonlinear4 -0.01244 0.04932 -0.2522 5521 0.8009 -0.1091 0.08423
fixed NA birth_order_nonlinear5 0.07847 0.05601 1.401 5489 0.1613 -0.03131 0.1883
fixed NA birth_order_nonlinear>5 0.006064 0.04625 0.1311 5931 0.8957 -0.08458 0.09671
ran_pars mother_pidlink sd__(Intercept) 0.3407 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9302 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -3.899 0.3829 -10.18 5894 3.712e-24 -4.649 -3.148
fixed NA poly(age, 3, raw = TRUE)1 0.2982 0.03608 8.265 5881 1.717e-16 0.2275 0.3689
fixed NA poly(age, 3, raw = TRUE)2 -0.007207 0.001077 -6.691 5864 0.00000000002416 -0.009319 -0.005096
fixed NA poly(age, 3, raw = TRUE)3 0.00005593 0.00001021 5.476 5853 0.00000004539 0.00003591 0.00007595
fixed NA male 0.1262 0.02645 4.771 5909 0.00000188 0.07434 0.178
fixed NA count_birth_order2/2 -0.02015 0.07713 -0.2613 5573 0.7939 -0.1713 0.131
fixed NA count_birth_order1/3 0.09485 0.06972 1.36 5895 0.1738 -0.04181 0.2315
fixed NA count_birth_order2/3 0.03908 0.0799 0.4891 5916 0.6248 -0.1175 0.1957
fixed NA count_birth_order3/3 0.05765 0.08899 0.6479 5921 0.5171 -0.1168 0.2321
fixed NA count_birth_order1/4 0.1217 0.07784 1.563 5912 0.118 -0.03087 0.2743
fixed NA count_birth_order2/4 0.02243 0.08287 0.2707 5916 0.7866 -0.14 0.1849
fixed NA count_birth_order3/4 -0.07628 0.08696 -0.8772 5920 0.3804 -0.2467 0.09416
fixed NA count_birth_order4/4 0.04495 0.09473 0.4745 5921 0.6352 -0.1407 0.2306
fixed NA count_birth_order1/5 0.07361 0.08756 0.8407 5918 0.4006 -0.09801 0.2452
fixed NA count_birth_order2/5 0.0388 0.09613 0.4036 5920 0.6865 -0.1496 0.2272
fixed NA count_birth_order3/5 0.03883 0.09843 0.3945 5919 0.6932 -0.1541 0.2318
fixed NA count_birth_order4/5 -0.1091 0.1005 -1.086 5914 0.2777 -0.3061 0.08788
fixed NA count_birth_order5/5 0.07412 0.1036 0.7154 5915 0.4744 -0.129 0.2772
fixed NA count_birth_order1/>5 -0.1477 0.06989 -2.113 5921 0.03468 -0.2846 -0.01067
fixed NA count_birth_order2/>5 -0.07679 0.07276 -1.055 5917 0.2913 -0.2194 0.06581
fixed NA count_birth_order3/>5 -0.05401 0.072 -0.7501 5915 0.4532 -0.1951 0.08711
fixed NA count_birth_order4/>5 -0.0383 0.0698 -0.5487 5920 0.5832 -0.1751 0.09851
fixed NA count_birth_order5/>5 0.02497 0.07063 0.3535 5915 0.7237 -0.1135 0.1634
fixed NA count_birth_order>5/>5 -0.05612 0.05586 -1.005 5575 0.3152 -0.1656 0.05337
ran_pars mother_pidlink sd__(Intercept) 0.3415 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9299 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 16736 16809 -8357 16714 NA NA NA
12 16737 16818 -8357 16713 0.4529 1 0.501
16 16742 16849 -8355 16710 3.397 4 0.4938
26 16752 16926 -8350 16700 10.14 10 0.4285

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -5.457 0.8887 -6.141 2513 0.0000000009516 -7.199 -3.715
fixed NA poly(age, 3, raw = TRUE)1 0.4617 0.0944 4.891 2515 0.000001066 0.2767 0.6468
fixed NA poly(age, 3, raw = TRUE)2 -0.01258 0.003215 -3.911 2516 0.00009423 -0.01888 -0.006274
fixed NA poly(age, 3, raw = TRUE)3 0.0001155 0.00003516 3.286 2517 0.001031 0.00004662 0.0001845
fixed NA male 0.17 0.04053 4.196 2517 0.00002814 0.0906 0.2495
fixed NA sibling_count3 0.03386 0.06327 0.5352 2061 0.5926 -0.09015 0.1579
fixed NA sibling_count4 -0.04681 0.06518 -0.7182 1914 0.4727 -0.1745 0.08093
fixed NA sibling_count5 -0.1543 0.07425 -2.078 1798 0.03787 -0.2998 -0.008749
fixed NA sibling_count>5 -0.1823 0.0642 -2.84 1712 0.004566 -0.3081 -0.05649
ran_pars mother_pidlink sd__(Intercept) 0.2543 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9641 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -5.45 0.8887 -6.133 2512 0.000000001 -7.192 -3.709
fixed NA birth_order 0.01116 0.01275 0.8758 2332 0.3812 -0.01382 0.03615
fixed NA poly(age, 3, raw = TRUE)1 0.4598 0.09444 4.869 2513 0.000001194 0.2747 0.6449
fixed NA poly(age, 3, raw = TRUE)2 -0.01253 0.003216 -3.897 2515 0.0001001 -0.01884 -0.006228
fixed NA poly(age, 3, raw = TRUE)3 0.0001155 0.00003516 3.284 2516 0.001038 0.00004655 0.0001844
fixed NA male 0.1691 0.04054 4.171 2516 0.00003137 0.08963 0.2485
fixed NA sibling_count3 0.02843 0.06359 0.4472 2061 0.6548 -0.0962 0.1531
fixed NA sibling_count4 -0.05926 0.06673 -0.8881 1922 0.3746 -0.19 0.07152
fixed NA sibling_count5 -0.175 0.07795 -2.245 1808 0.02487 -0.3278 -0.02224
fixed NA sibling_count>5 -0.2227 0.07907 -2.817 1791 0.004904 -0.3777 -0.06775
ran_pars mother_pidlink sd__(Intercept) 0.2562 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9637 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -5.411 0.8892 -6.085 2508 0.000000001346 -7.154 -3.668
fixed NA poly(age, 3, raw = TRUE)1 0.4567 0.09448 4.833 2510 0.000001423 0.2715 0.6418
fixed NA poly(age, 3, raw = TRUE)2 -0.01242 0.003218 -3.861 2511 0.0001157 -0.01873 -0.006117
fixed NA poly(age, 3, raw = TRUE)3 0.0001143 0.00003518 3.248 2512 0.001179 0.0000453 0.0001832
fixed NA male 0.1692 0.04053 4.174 2512 0.00003095 0.08973 0.2486
fixed NA sibling_count3 0.01621 0.06489 0.2498 2123 0.8027 -0.111 0.1434
fixed NA sibling_count4 -0.08453 0.06948 -1.216 2061 0.2239 -0.2207 0.05166
fixed NA sibling_count5 -0.1747 0.08228 -2.123 1980 0.03385 -0.336 -0.01344
fixed NA sibling_count>5 -0.2263 0.08151 -2.777 1904 0.005541 -0.3861 -0.06659
fixed NA birth_order_nonlinear2 0.01137 0.05292 0.2149 2230 0.8299 -0.09235 0.1151
fixed NA birth_order_nonlinear3 0.07625 0.06357 1.199 2315 0.2305 -0.04834 0.2008
fixed NA birth_order_nonlinear4 0.101 0.07699 1.311 2364 0.1899 -0.04993 0.2519
fixed NA birth_order_nonlinear5 -0.07953 0.09654 -0.8238 2417 0.4101 -0.2687 0.1097
fixed NA birth_order_nonlinear>5 0.09209 0.09551 0.9642 2473 0.335 -0.09511 0.2793
ran_pars mother_pidlink sd__(Intercept) 0.262 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.962 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -5.375 0.8908 -6.033 2498 0.000000001844 -7.121 -3.629
fixed NA poly(age, 3, raw = TRUE)1 0.4507 0.09477 4.756 2499 0.000002085 0.265 0.6365
fixed NA poly(age, 3, raw = TRUE)2 -0.01218 0.003228 -3.774 2501 0.0001641 -0.01851 -0.005857
fixed NA poly(age, 3, raw = TRUE)3 0.0001113 0.0000353 3.153 2502 0.001636 0.00004211 0.0001805
fixed NA male 0.1628 0.04062 4.007 2502 0.00006336 0.08315 0.2424
fixed NA count_birth_order2/2 0.05057 0.0999 0.5062 2260 0.6128 -0.1452 0.2464
fixed NA count_birth_order1/3 0.008137 0.08297 0.09806 2501 0.9219 -0.1545 0.1708
fixed NA count_birth_order2/3 0.11 0.09415 1.168 2502 0.2428 -0.07454 0.2945
fixed NA count_birth_order3/3 0.05356 0.1036 0.5168 2500 0.6054 -0.1496 0.2567
fixed NA count_birth_order1/4 -0.09397 0.09738 -0.965 2502 0.3347 -0.2848 0.09689
fixed NA count_birth_order2/4 -0.06464 0.1005 -0.6428 2502 0.5204 -0.2617 0.1324
fixed NA count_birth_order3/4 0.04913 0.1063 0.4623 2500 0.6439 -0.1592 0.2574
fixed NA count_birth_order4/4 0.0121 0.1135 0.1066 2498 0.9151 -0.2104 0.2346
fixed NA count_birth_order1/5 -0.008234 0.1311 -0.06281 2502 0.9499 -0.2652 0.2487
fixed NA count_birth_order2/5 -0.1178 0.153 -0.7701 2497 0.4413 -0.4177 0.182
fixed NA count_birth_order3/5 -0.1788 0.1381 -1.295 2500 0.1955 -0.4495 0.09185
fixed NA count_birth_order4/5 -0.04439 0.1305 -0.3402 2498 0.7337 -0.3001 0.2113
fixed NA count_birth_order5/5 -0.3668 0.1344 -2.729 2499 0.0064 -0.6302 -0.1033
fixed NA count_birth_order1/>5 -0.1898 0.1294 -1.467 2502 0.1424 -0.4434 0.06372
fixed NA count_birth_order2/>5 -0.4359 0.1304 -3.343 2501 0.0008405 -0.6915 -0.1804
fixed NA count_birth_order3/>5 -0.0447 0.1321 -0.3384 2501 0.7351 -0.3036 0.2142
fixed NA count_birth_order4/>5 -0.1088 0.1208 -0.9012 2496 0.3676 -0.3455 0.1279
fixed NA count_birth_order5/>5 -0.2063 0.1181 -1.747 2494 0.08069 -0.4377 0.0251
fixed NA count_birth_order>5/>5 -0.122 0.0885 -1.378 2360 0.1682 -0.2954 0.05147
ran_pars mother_pidlink sd__(Intercept) 0.2591 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9626 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 7164 7228 -3571 7142 NA NA NA
12 7165 7235 -3570 7141 0.7669 1 0.3812
16 7168 7261 -3568 7136 4.699 4 0.3195
26 7177 7329 -3563 7125 10.95 10 0.3616

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -5.441 0.8839 -6.156 2529 0.0000000008662 -7.173 -3.708
fixed NA poly(age, 3, raw = TRUE)1 0.4605 0.09398 4.9 2530 0.000001019 0.2763 0.6447
fixed NA poly(age, 3, raw = TRUE)2 -0.01255 0.003201 -3.921 2532 0.00009034 -0.01883 -0.006279
fixed NA poly(age, 3, raw = TRUE)3 0.0001153 0.00003501 3.292 2533 0.001008 0.00004664 0.0001839
fixed NA male 0.1649 0.04032 4.089 2533 0.00004466 0.08584 0.2439
fixed NA sibling_count3 0.03006 0.06953 0.4324 2134 0.6655 -0.1062 0.1663
fixed NA sibling_count4 0.01484 0.07034 0.2109 2025 0.833 -0.123 0.1527
fixed NA sibling_count5 -0.1237 0.07397 -1.673 1900 0.09451 -0.2687 0.02123
fixed NA sibling_count>5 -0.153 0.06571 -2.328 1970 0.02003 -0.2817 -0.02416
ran_pars mother_pidlink sd__(Intercept) 0.2542 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.962 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -5.441 0.884 -6.154 2528 0.0000000008751 -7.173 -3.708
fixed NA birth_order 0.001754 0.01111 0.158 2270 0.8745 -0.02002 0.02352
fixed NA poly(age, 3, raw = TRUE)1 0.4603 0.09402 4.896 2529 0.000001042 0.276 0.6446
fixed NA poly(age, 3, raw = TRUE)2 -0.01255 0.003202 -3.919 2531 0.00009134 -0.01882 -0.006272
fixed NA poly(age, 3, raw = TRUE)3 0.0001153 0.00003501 3.292 2532 0.001009 0.00004663 0.0001839
fixed NA male 0.1647 0.04034 4.083 2532 0.00004582 0.08564 0.2438
fixed NA sibling_count3 0.02918 0.06976 0.4183 2132 0.6757 -0.1076 0.1659
fixed NA sibling_count4 0.01296 0.07136 0.1816 2021 0.8559 -0.1269 0.1528
fixed NA sibling_count5 -0.1267 0.07636 -1.66 1899 0.09714 -0.2764 0.02293
fixed NA sibling_count>5 -0.1591 0.07655 -2.079 1976 0.03775 -0.3092 -0.00911
ran_pars mother_pidlink sd__(Intercept) 0.2551 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9619 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -5.442 0.8838 -6.157 2524 0.0000000008593 -7.174 -3.71
fixed NA poly(age, 3, raw = TRUE)1 0.4599 0.09399 4.893 2526 0.000001054 0.2757 0.6442
fixed NA poly(age, 3, raw = TRUE)2 -0.01254 0.003201 -3.916 2527 0.00009242 -0.01881 -0.006262
fixed NA poly(age, 3, raw = TRUE)3 0.0001151 0.000035 3.289 2528 0.001018 0.00004653 0.0001837
fixed NA male 0.1643 0.0403 4.077 2528 0.00004697 0.08532 0.2433
fixed NA sibling_count3 0.009383 0.07102 0.1321 2177 0.8949 -0.1298 0.1486
fixed NA sibling_count4 -0.0289 0.07374 -0.3919 2122 0.6952 -0.1734 0.1156
fixed NA sibling_count5 -0.1455 0.07999 -1.819 2042 0.06907 -0.3023 0.01128
fixed NA sibling_count>5 -0.1811 0.07882 -2.297 2072 0.02169 -0.3356 -0.0266
fixed NA birth_order_nonlinear2 0.02068 0.05343 0.3871 2271 0.6987 -0.08405 0.1254
fixed NA birth_order_nonlinear3 0.09024 0.06368 1.417 2376 0.1566 -0.03457 0.215
fixed NA birth_order_nonlinear4 0.1398 0.07445 1.878 2396 0.06046 -0.00608 0.2858
fixed NA birth_order_nonlinear5 -0.1024 0.0914 -1.121 2434 0.2625 -0.2816 0.07671
fixed NA birth_order_nonlinear>5 0.03478 0.08567 0.406 2463 0.6847 -0.1331 0.2027
ran_pars mother_pidlink sd__(Intercept) 0.2586 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9602 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -5.453 0.8868 -6.149 2513 0.0000000009035 -7.191 -3.715
fixed NA poly(age, 3, raw = TRUE)1 0.4599 0.09439 4.873 2515 0.00000117 0.2749 0.6449
fixed NA poly(age, 3, raw = TRUE)2 -0.01251 0.003215 -3.89 2517 0.0001027 -0.01881 -0.006206
fixed NA poly(age, 3, raw = TRUE)3 0.0001146 0.00003516 3.259 2518 0.001133 0.00004568 0.0001835
fixed NA male 0.1614 0.04046 3.989 2518 0.00006832 0.08207 0.2407
fixed NA count_birth_order2/2 0.03684 0.1127 0.327 2336 0.7437 -0.184 0.2577
fixed NA count_birth_order1/3 -0.01654 0.09127 -0.1812 2517 0.8562 -0.1954 0.1624
fixed NA count_birth_order2/3 0.1026 0.1014 1.012 2518 0.3117 -0.09611 0.3012
fixed NA count_birth_order3/3 0.07168 0.1133 0.6325 2517 0.5271 -0.1505 0.2938
fixed NA count_birth_order1/4 0.000209 0.1026 0.002036 2518 0.9984 -0.2009 0.2014
fixed NA count_birth_order2/4 0.01402 0.1032 0.1358 2518 0.892 -0.1883 0.2164
fixed NA count_birth_order3/4 0.02956 0.1166 0.2536 2516 0.7998 -0.1989 0.258
fixed NA count_birth_order4/4 0.08172 0.124 0.6593 2514 0.5098 -0.1612 0.3247
fixed NA count_birth_order1/5 -0.07394 0.1193 -0.6201 2518 0.5353 -0.3077 0.1598
fixed NA count_birth_order2/5 -0.1639 0.1313 -1.249 2515 0.2118 -0.4212 0.09335
fixed NA count_birth_order3/5 -0.01559 0.1312 -0.1188 2515 0.9054 -0.2727 0.2415
fixed NA count_birth_order4/5 0.03078 0.1323 0.2328 2512 0.816 -0.2284 0.29
fixed NA count_birth_order5/5 -0.3571 0.1317 -2.712 2514 0.006743 -0.6153 -0.09899
fixed NA count_birth_order1/>5 -0.1954 0.1136 -1.72 2517 0.08555 -0.4181 0.02726
fixed NA count_birth_order2/>5 -0.2732 0.1208 -2.263 2518 0.02375 -0.5099 -0.03654
fixed NA count_birth_order3/>5 -0.03812 0.122 -0.3126 2517 0.7546 -0.2772 0.2009
fixed NA count_birth_order4/>5 -0.03309 0.1126 -0.2937 2516 0.769 -0.2539 0.1877
fixed NA count_birth_order5/>5 -0.1922 0.1201 -1.6 2510 0.1097 -0.4277 0.04322
fixed NA count_birth_order>5/>5 -0.1421 0.08825 -1.61 2406 0.1075 -0.3151 0.03088
ran_pars mother_pidlink sd__(Intercept) 0.2591 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9609 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 7198 7262 -3588 7176 NA NA NA
12 7200 7270 -3588 7176 0.02429 1 0.8761
16 7200 7293 -3584 7168 8.315 4 0.08069
26 7214 7366 -3581 7162 5.651 10 0.8437

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -5.422 0.9015 -6.014 2464 0.000000002078 -7.188 -3.655
fixed NA poly(age, 3, raw = TRUE)1 0.4572 0.09577 4.773 2465 0.000001918 0.2694 0.6449
fixed NA poly(age, 3, raw = TRUE)2 -0.01237 0.00326 -3.794 2467 0.0001518 -0.01876 -0.005979
fixed NA poly(age, 3, raw = TRUE)3 0.0001128 0.00003563 3.166 2468 0.001565 0.00004296 0.0001826
fixed NA male 0.1739 0.04126 4.215 2468 0.00002588 0.09305 0.2548
fixed NA sibling_count3 -0.003189 0.06289 -0.05071 2016 0.9596 -0.1264 0.1201
fixed NA sibling_count4 -0.1003 0.06552 -1.53 1856 0.1261 -0.2287 0.02815
fixed NA sibling_count5 -0.1661 0.07676 -2.164 1689 0.03057 -0.3166 -0.01569
fixed NA sibling_count>5 -0.1681 0.06519 -2.579 1623 0.009992 -0.2959 -0.04036
ran_pars mother_pidlink sd__(Intercept) 0.2569 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.972 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -5.415 0.9017 -6.005 2463 0.000000002191 -7.182 -3.648
fixed NA birth_order 0.008665 0.0132 0.6563 2305 0.5117 -0.01721 0.03455
fixed NA poly(age, 3, raw = TRUE)1 0.4554 0.09582 4.753 2464 0.000002122 0.2676 0.6432
fixed NA poly(age, 3, raw = TRUE)2 -0.01233 0.003261 -3.78 2466 0.0001607 -0.01872 -0.005935
fixed NA poly(age, 3, raw = TRUE)3 0.0001127 0.00003563 3.161 2467 0.001589 0.00004281 0.0001825
fixed NA male 0.1734 0.04128 4.2 2467 0.00002758 0.09248 0.2543
fixed NA sibling_count3 -0.007568 0.06326 -0.1196 2014 0.9048 -0.1315 0.1164
fixed NA sibling_count4 -0.1098 0.06712 -1.635 1867 0.1021 -0.2413 0.02178
fixed NA sibling_count5 -0.1818 0.08039 -2.261 1703 0.02388 -0.3393 -0.0242
fixed NA sibling_count>5 -0.1994 0.08076 -2.469 1739 0.01365 -0.3577 -0.0411
ran_pars mother_pidlink sd__(Intercept) 0.2582 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9718 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -5.41 0.9024 -5.996 2459 0.000000002325 -7.179 -3.642
fixed NA poly(age, 3, raw = TRUE)1 0.4563 0.09589 4.759 2461 0.00000206 0.2684 0.6443
fixed NA poly(age, 3, raw = TRUE)2 -0.01236 0.003263 -3.788 2462 0.0001554 -0.01876 -0.005966
fixed NA poly(age, 3, raw = TRUE)3 0.0001131 0.00003566 3.171 2463 0.001537 0.00004319 0.000183
fixed NA male 0.174 0.04128 4.214 2463 0.00002595 0.09307 0.2549
fixed NA sibling_count3 -0.02677 0.06466 -0.4139 2076 0.679 -0.1535 0.09997
fixed NA sibling_count4 -0.1287 0.06985 -1.842 2007 0.06558 -0.2656 0.008219
fixed NA sibling_count5 -0.1758 0.08455 -2.079 1877 0.03777 -0.3415 -0.01005
fixed NA sibling_count>5 -0.2091 0.08338 -2.508 1859 0.01222 -0.3726 -0.04571
fixed NA birth_order_nonlinear2 -0.0007985 0.0533 -0.01498 2180 0.988 -0.1053 0.1037
fixed NA birth_order_nonlinear3 0.09794 0.06412 1.528 2269 0.1268 -0.02772 0.2236
fixed NA birth_order_nonlinear4 0.0248 0.08029 0.3089 2301 0.7574 -0.1326 0.1822
fixed NA birth_order_nonlinear5 -0.07846 0.1009 -0.7773 2332 0.4371 -0.2763 0.1194
fixed NA birth_order_nonlinear>5 0.1007 0.09905 1.016 2422 0.3097 -0.09349 0.2948
ran_pars mother_pidlink sd__(Intercept) 0.2667 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9694 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -5.398 0.9042 -5.97 2448 0.000000002716 -7.171 -3.626
fixed NA poly(age, 3, raw = TRUE)1 0.4538 0.09623 4.715 2450 0.000002547 0.2652 0.6424
fixed NA poly(age, 3, raw = TRUE)2 -0.01223 0.003276 -3.734 2452 0.0001926 -0.01865 -0.005812
fixed NA poly(age, 3, raw = TRUE)3 0.0001112 0.0000358 3.106 2452 0.001917 0.00004103 0.0001814
fixed NA male 0.1673 0.04143 4.04 2453 0.0000552 0.08615 0.2485
fixed NA count_birth_order2/2 0.01444 0.09844 0.1467 2189 0.8834 -0.1785 0.2074
fixed NA count_birth_order1/3 -0.06221 0.08283 -0.751 2451 0.4527 -0.2246 0.1001
fixed NA count_birth_order2/3 0.07763 0.09437 0.8226 2453 0.4108 -0.1073 0.2626
fixed NA count_birth_order3/3 0.03025 0.1018 0.297 2450 0.7665 -0.1694 0.2299
fixed NA count_birth_order1/4 -0.1345 0.09873 -1.362 2453 0.1734 -0.328 0.05905
fixed NA count_birth_order2/4 -0.1646 0.1011 -1.628 2453 0.1037 -0.3628 0.0336
fixed NA count_birth_order3/4 0.02741 0.1071 0.2559 2451 0.798 -0.1825 0.2373
fixed NA count_birth_order4/4 -0.08879 0.1173 -0.757 2448 0.4491 -0.3187 0.1411
fixed NA count_birth_order1/5 -0.002286 0.1351 -0.01692 2453 0.9865 -0.2671 0.2626
fixed NA count_birth_order2/5 -0.1884 0.157 -1.2 2449 0.2301 -0.4961 0.1192
fixed NA count_birth_order3/5 -0.1273 0.146 -0.8719 2451 0.3833 -0.4136 0.1589
fixed NA count_birth_order4/5 -0.2074 0.1387 -1.496 2448 0.1349 -0.4792 0.0644
fixed NA count_birth_order5/5 -0.3175 0.1436 -2.211 2450 0.02713 -0.5989 -0.03604
fixed NA count_birth_order1/>5 -0.1604 0.1323 -1.212 2453 0.2256 -0.4196 0.09893
fixed NA count_birth_order2/>5 -0.3924 0.1365 -2.875 2451 0.004072 -0.66 -0.1249
fixed NA count_birth_order3/>5 -0.06706 0.134 -0.5004 2452 0.6169 -0.3297 0.1956
fixed NA count_birth_order4/>5 -0.1438 0.1262 -1.14 2447 0.2543 -0.3911 0.1034
fixed NA count_birth_order5/>5 -0.2396 0.1213 -1.974 2444 0.04845 -0.4774 -0.001747
fixed NA count_birth_order>5/>5 -0.1037 0.09056 -1.145 2291 0.2523 -0.2812 0.0738
ran_pars mother_pidlink sd__(Intercept) 0.261 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.9711 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 7066 7130 -3522 7044 NA NA NA
12 7067 7137 -3522 7043 0.4305 1 0.5117
16 7070 7163 -3519 7038 4.865 4 0.3014
26 7082 7233 -3515 7030 8.758 10 0.5552

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Self-Employment - non standardized

birthorder <- birthorder %>% mutate(outcome = Self_employed)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2665 0.095 -2.805 9917 0.005038 -0.4527 -0.08029
fixed NA poly(age, 3, raw = TRUE)1 0.02362 0.008521 2.772 9866 0.005576 0.006922 0.04033
fixed NA poly(age, 3, raw = TRUE)2 -0.0001646 0.0002393 -0.6879 9765 0.4915 -0.0006336 0.0003044
fixed NA poly(age, 3, raw = TRUE)3 -0.0000002153 0.000002126 -0.1013 9648 0.9193 -0.000004382 0.000003952
fixed NA male -0.002977 0.008766 -0.3396 9989 0.7342 -0.02016 0.0142
fixed NA sibling_count3 -0.02246 0.01828 -1.229 7683 0.2192 -0.05828 0.01337
fixed NA sibling_count4 -0.01987 0.01844 -1.077 7310 0.2813 -0.056 0.01627
fixed NA sibling_count5 -0.01023 0.01921 -0.5326 6871 0.5944 -0.04789 0.02743
fixed NA sibling_count>5 0.01732 0.0149 1.162 7571 0.2452 -0.01188 0.04651
ran_pars mother_pidlink sd__(Intercept) 0.1531 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4098 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2668 0.09499 -2.809 9915 0.004984 -0.453 -0.08063
fixed NA birth_order 0.002029 0.001784 1.137 9196 0.2556 -0.001469 0.005526
fixed NA poly(age, 3, raw = TRUE)1 0.02307 0.008535 2.703 9857 0.006891 0.006339 0.0398
fixed NA poly(age, 3, raw = TRUE)2 -0.0001441 0.00024 -0.6006 9731 0.5481 -0.0006145 0.0003262
fixed NA poly(age, 3, raw = TRUE)3 -0.0000004013 0.000002132 -0.1882 9599 0.8507 -0.00000458 0.000003778
fixed NA male -0.003007 0.008766 -0.3431 9989 0.7315 -0.02019 0.01417
fixed NA sibling_count3 -0.023 0.01828 -1.258 7695 0.2084 -0.05884 0.01283
fixed NA sibling_count4 -0.0211 0.01847 -1.143 7356 0.2532 -0.0573 0.01509
fixed NA sibling_count5 -0.01241 0.01931 -0.6426 6958 0.5205 -0.05025 0.02544
fixed NA sibling_count>5 0.01022 0.01615 0.6328 8281 0.5269 -0.02144 0.04188
ran_pars mother_pidlink sd__(Intercept) 0.1529 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4098 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2752 0.09511 -2.893 9918 0.003821 -0.4616 -0.08877
fixed NA poly(age, 3, raw = TRUE)1 0.02319 0.008541 2.715 9858 0.006636 0.00645 0.03993
fixed NA poly(age, 3, raw = TRUE)2 -0.0001598 0.0002401 -0.6657 9735 0.5056 -0.0006303 0.0003107
fixed NA poly(age, 3, raw = TRUE)3 -0.0000001582 0.000002133 -0.07415 9600 0.9409 -0.000004338 0.000004022
fixed NA male -0.003111 0.008765 -0.3549 9984 0.7227 -0.02029 0.01407
fixed NA sibling_count3 -0.02462 0.01855 -1.327 7932 0.1844 -0.06098 0.01173
fixed NA sibling_count4 -0.02199 0.01896 -1.16 7793 0.2461 -0.05915 0.01517
fixed NA sibling_count5 -0.01296 0.01996 -0.6493 7524 0.5162 -0.05208 0.02616
fixed NA sibling_count>5 0.01309 0.01691 0.7741 8865 0.4389 -0.02005 0.04623
fixed NA birth_order_nonlinear2 0.03823 0.01276 2.997 9348 0.002737 0.01323 0.06324
fixed NA birth_order_nonlinear3 0.01961 0.01483 1.322 9199 0.1861 -0.009457 0.04867
fixed NA birth_order_nonlinear4 0.0146 0.01665 0.877 9276 0.3805 -0.01803 0.04724
fixed NA birth_order_nonlinear5 0.01968 0.01874 1.05 9304 0.2936 -0.01704 0.0564
fixed NA birth_order_nonlinear>5 0.02218 0.01558 1.423 10079 0.1546 -0.008359 0.05271
ran_pars mother_pidlink sd__(Intercept) 0.1529 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4097 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2834 0.09546 -2.969 9918 0.002995 -0.4705 -0.09631
fixed NA poly(age, 3, raw = TRUE)1 0.02291 0.008548 2.68 9849 0.007384 0.006152 0.03966
fixed NA poly(age, 3, raw = TRUE)2 -0.0001582 0.0002402 -0.6585 9723 0.5102 -0.000629 0.0003126
fixed NA poly(age, 3, raw = TRUE)3 -0.000000111 0.000002134 -0.052 9586 0.9585 -0.000004293 0.000004072
fixed NA male -0.003372 0.008769 -0.3845 9975 0.7006 -0.02056 0.01382
fixed NA count_birth_order2/2 0.07421 0.02534 2.928 9275 0.003418 0.02454 0.1239
fixed NA count_birth_order1/3 -0.02418 0.02456 -0.9844 9991 0.3249 -0.07231 0.02396
fixed NA count_birth_order2/3 0.03323 0.02722 1.221 10030 0.2221 -0.02011 0.08657
fixed NA count_birth_order3/3 0.02459 0.02989 0.8229 10053 0.4106 -0.03398 0.08317
fixed NA count_birth_order1/4 0.01501 0.0269 0.5579 10031 0.5769 -0.03772 0.06773
fixed NA count_birth_order2/4 0.005201 0.02884 0.1804 10046 0.8569 -0.05132 0.06173
fixed NA count_birth_order3/4 -0.005191 0.03075 -0.1688 10061 0.8659 -0.06545 0.05507
fixed NA count_birth_order4/4 0.01914 0.03266 0.5862 10066 0.5578 -0.04486 0.08315
fixed NA count_birth_order1/5 0.009117 0.03054 0.2985 10059 0.7653 -0.05074 0.06897
fixed NA count_birth_order2/5 0.04643 0.03238 1.434 10065 0.1517 -0.01704 0.1099
fixed NA count_birth_order3/5 0.03461 0.03409 1.015 10069 0.31 -0.0322 0.1014
fixed NA count_birth_order4/5 -0.01429 0.03583 -0.3989 10068 0.69 -0.08451 0.05593
fixed NA count_birth_order5/5 0.0102 0.03582 0.2846 10071 0.7759 -0.06001 0.0804
fixed NA count_birth_order1/>5 0.03492 0.02352 1.485 10069 0.1377 -0.01118 0.08102
fixed NA count_birth_order2/>5 0.05428 0.02449 2.216 10071 0.02672 0.006268 0.1023
fixed NA count_birth_order3/>5 0.04115 0.02413 1.705 10071 0.0882 -0.006149 0.08844
fixed NA count_birth_order4/>5 0.04521 0.0237 1.907 10070 0.05649 -0.001244 0.09166
fixed NA count_birth_order5/>5 0.04958 0.02396 2.069 10071 0.03857 0.002613 0.09655
fixed NA count_birth_order>5/>5 0.04898 0.01941 2.523 9318 0.01164 0.01094 0.08703
ran_pars mother_pidlink sd__(Intercept) 0.153 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4097 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 11871 11950 -5924 11849 NA NA NA
12 11871 11958 -5924 11847 1.295 1 0.2552
16 11872 11987 -5920 11840 7.919 4 0.0946
26 11883 12071 -5916 11831 8.217 10 0.6077

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9428 0.2612 3.609 3819 0.0003116 0.4307 1.455
fixed NA poly(age, 3, raw = TRUE)1 -0.1058 0.02805 -3.773 3817 0.0001635 -0.1608 -0.05087
fixed NA poly(age, 3, raw = TRUE)2 0.004147 0.0009623 4.309 3815 0.00001678 0.002261 0.006033
fixed NA poly(age, 3, raw = TRUE)3 -0.00004614 0.00001056 -4.368 3814 0.00001288 -0.00006685 -0.00002544
fixed NA male -0.02367 0.01315 -1.8 3785 0.0719 -0.04943 0.0021
fixed NA sibling_count3 0.01552 0.02194 0.7075 3125 0.4793 -0.02747 0.05851
fixed NA sibling_count4 -0.02907 0.02271 -1.28 2946 0.2007 -0.07358 0.01545
fixed NA sibling_count5 0.03856 0.02531 1.524 2677 0.1277 -0.01104 0.08815
fixed NA sibling_count>5 0.04773 0.02198 2.172 2660 0.02998 0.00465 0.09081
ran_pars mother_pidlink sd__(Intercept) 0.1578 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3721 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9413 0.2613 3.602 3819 0.0003195 0.4291 1.453
fixed NA birth_order -0.001447 0.004107 -0.3524 3766 0.7246 -0.009497 0.006603
fixed NA poly(age, 3, raw = TRUE)1 -0.1055 0.02807 -3.759 3817 0.0001733 -0.1605 -0.05049
fixed NA poly(age, 3, raw = TRUE)2 0.004138 0.0009626 4.299 3815 0.00001761 0.002251 0.006025
fixed NA poly(age, 3, raw = TRUE)3 -0.00004611 0.00001057 -4.364 3813 0.00001308 -0.00006682 -0.0000254
fixed NA male -0.02362 0.01315 -1.796 3783 0.07252 -0.04939 0.002152
fixed NA sibling_count3 0.01627 0.02204 0.7382 3124 0.4605 -0.02693 0.05948
fixed NA sibling_count4 -0.02744 0.02318 -1.184 2948 0.2365 -0.07288 0.01799
fixed NA sibling_count5 0.0412 0.02642 1.559 2723 0.119 -0.01058 0.09299
fixed NA sibling_count>5 0.05295 0.02654 1.995 2828 0.04609 0.0009406 0.105
ran_pars mother_pidlink sd__(Intercept) 0.1582 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.372 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9329 0.2617 3.565 3815 0.0003682 0.42 1.446
fixed NA poly(age, 3, raw = TRUE)1 -0.1051 0.02809 -3.742 3812 0.0001852 -0.1602 -0.05006
fixed NA poly(age, 3, raw = TRUE)2 0.004127 0.0009634 4.283 3810 0.00001887 0.002238 0.006015
fixed NA poly(age, 3, raw = TRUE)3 -0.00004607 0.00001058 -4.355 3808 0.00001363 -0.0000668 -0.00002534
fixed NA male -0.02352 0.01315 -1.788 3779 0.07392 -0.0493 0.002267
fixed NA sibling_count3 0.0156 0.02247 0.6942 3214 0.4876 -0.02844 0.05964
fixed NA sibling_count4 -0.02767 0.02398 -1.154 3114 0.2487 -0.07467 0.01933
fixed NA sibling_count5 0.04284 0.02763 1.55 2963 0.1212 -0.01132 0.09699
fixed NA sibling_count>5 0.0613 0.02722 2.252 2955 0.02438 0.007956 0.1147
fixed NA birth_order_nonlinear2 0.01025 0.01727 0.5934 3368 0.553 -0.02361 0.04411
fixed NA birth_order_nonlinear3 0.001374 0.02033 0.06759 3441 0.9461 -0.03848 0.04123
fixed NA birth_order_nonlinear4 -0.002639 0.02479 -0.1065 3498 0.9152 -0.05122 0.04594
fixed NA birth_order_nonlinear5 -0.008891 0.03048 -0.2917 3505 0.7706 -0.06864 0.05086
fixed NA birth_order_nonlinear>5 -0.02557 0.03043 -0.8404 3817 0.4007 -0.08522 0.03407
ran_pars mother_pidlink sd__(Intercept) 0.1581 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3722 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9316 0.2628 3.545 3805 0.000397 0.4166 1.447
fixed NA poly(age, 3, raw = TRUE)1 -0.1065 0.02821 -3.774 3803 0.0001631 -0.1618 -0.05117
fixed NA poly(age, 3, raw = TRUE)2 0.004174 0.0009678 4.313 3801 0.00001652 0.002277 0.006071
fixed NA poly(age, 3, raw = TRUE)3 -0.00004658 0.00001063 -4.383 3800 0.000012 -0.00006741 -0.00002575
fixed NA male -0.02415 0.01318 -1.832 3769 0.067 -0.04998 0.001684
fixed NA count_birth_order2/2 0.05231 0.0336 1.557 3475 0.1196 -0.01355 0.1182
fixed NA count_birth_order1/3 0.03981 0.02861 1.392 3792 0.1641 -0.01626 0.09589
fixed NA count_birth_order2/3 0.03881 0.03176 1.222 3805 0.2218 -0.02344 0.1011
fixed NA count_birth_order3/3 0.01045 0.03434 0.3044 3807 0.7609 -0.05685 0.07775
fixed NA count_birth_order1/4 -0.008259 0.03285 -0.2514 3802 0.8015 -0.07264 0.05612
fixed NA count_birth_order2/4 -0.02985 0.03453 -0.8646 3807 0.3873 -0.09752 0.03782
fixed NA count_birth_order3/4 -0.01272 0.0362 -0.3513 3804 0.7254 -0.08366 0.05823
fixed NA count_birth_order4/4 0.008705 0.03839 0.2267 3801 0.8206 -0.06654 0.08395
fixed NA count_birth_order1/5 0.05321 0.04307 1.235 3807 0.2168 -0.03121 0.1376
fixed NA count_birth_order2/5 0.07654 0.04684 1.634 3790 0.1023 -0.01527 0.1684
fixed NA count_birth_order3/5 0.06749 0.04389 1.538 3795 0.1242 -0.01854 0.1535
fixed NA count_birth_order4/5 0.05473 0.04269 1.282 3794 0.1999 -0.02895 0.1384
fixed NA count_birth_order5/5 0.02978 0.04476 0.6652 3789 0.506 -0.05796 0.1175
fixed NA count_birth_order1/>5 0.07785 0.04095 1.901 3804 0.05738 -0.002414 0.1581
fixed NA count_birth_order2/>5 0.07465 0.04131 1.807 3792 0.07084 -0.006317 0.1556
fixed NA count_birth_order3/>5 0.09799 0.04038 2.426 3787 0.01529 0.01884 0.1771
fixed NA count_birth_order4/>5 0.04506 0.03922 1.149 3779 0.2506 -0.0318 0.1219
fixed NA count_birth_order5/>5 0.07709 0.03782 2.038 3785 0.0416 0.00296 0.1512
fixed NA count_birth_order>5/>5 0.04905 0.0296 1.657 3670 0.09751 -0.008953 0.1071
ran_pars mother_pidlink sd__(Intercept) 0.1579 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3725 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 3908 3977 -1943 3886 NA NA NA
12 3910 3985 -1943 3886 0.122 1 0.7269
16 3917 4017 -1942 3885 1.352 4 0.8525
26 3931 4094 -1940 3879 5.638 10 0.8447

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.917 0.2603 3.523 3846 0.0004316 0.4068 1.427
fixed NA poly(age, 3, raw = TRUE)1 -0.1019 0.02798 -3.642 3843 0.0002737 -0.1567 -0.04707
fixed NA poly(age, 3, raw = TRUE)2 0.004027 0.0009598 4.196 3841 0.00002782 0.002146 0.005909
fixed NA poly(age, 3, raw = TRUE)3 -0.00004496 0.00001054 -4.266 3840 0.00002039 -0.00006562 -0.0000243
fixed NA male -0.02421 0.01311 -1.847 3810 0.06483 -0.04991 0.001481
fixed NA sibling_count3 -0.006695 0.02405 -0.2784 3201 0.7807 -0.05383 0.04044
fixed NA sibling_count4 -0.03614 0.02428 -1.489 3079 0.1366 -0.08372 0.01144
fixed NA sibling_count5 -0.008562 0.02563 -0.3341 2892 0.7383 -0.05879 0.04167
fixed NA sibling_count>5 0.0278 0.02245 1.238 2968 0.2157 -0.0162 0.0718
ran_pars mother_pidlink sd__(Intercept) 0.1587 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.372 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9174 0.2603 3.524 3845 0.0004304 0.4071 1.428
fixed NA birth_order 0.0004435 0.003628 0.1222 3719 0.9027 -0.006668 0.007555
fixed NA poly(age, 3, raw = TRUE)1 -0.102 0.02799 -3.644 3843 0.0002721 -0.1568 -0.04713
fixed NA poly(age, 3, raw = TRUE)2 0.00403 0.0009601 4.197 3841 0.00002769 0.002148 0.005911
fixed NA poly(age, 3, raw = TRUE)3 -0.00004497 0.00001054 -4.266 3839 0.0000204 -0.00006563 -0.00002431
fixed NA male -0.02422 0.01311 -1.848 3809 0.06474 -0.04992 0.001474
fixed NA sibling_count3 -0.006931 0.02413 -0.2872 3197 0.7739 -0.05422 0.04036
fixed NA sibling_count4 -0.03661 0.02457 -1.49 3071 0.1364 -0.08477 0.01156
fixed NA sibling_count5 -0.009323 0.02638 -0.3534 2901 0.7238 -0.06102 0.04238
fixed NA sibling_count>5 0.02623 0.02589 1.013 3022 0.311 -0.02451 0.07696
ran_pars mother_pidlink sd__(Intercept) 0.1587 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3721 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9044 0.2607 3.47 3841 0.0005271 0.3935 1.415
fixed NA poly(age, 3, raw = TRUE)1 -0.1011 0.02801 -3.608 3839 0.0003122 -0.156 -0.04616
fixed NA poly(age, 3, raw = TRUE)2 0.003996 0.0009609 4.159 3836 0.00003269 0.002113 0.00588
fixed NA poly(age, 3, raw = TRUE)3 -0.00004462 0.00001055 -4.229 3835 0.00002404 -0.00006531 -0.00002394
fixed NA male -0.02403 0.01312 -1.832 3804 0.06702 -0.04974 0.001677
fixed NA sibling_count3 -0.01015 0.02454 -0.4134 3267 0.6793 -0.05824 0.03795
fixed NA sibling_count4 -0.03844 0.02528 -1.521 3196 0.1284 -0.08799 0.0111
fixed NA sibling_count5 -0.008874 0.02749 -0.3228 3097 0.7469 -0.06275 0.04501
fixed NA sibling_count>5 0.02904 0.02661 1.091 3148 0.2752 -0.02311 0.08119
fixed NA birth_order_nonlinear2 0.01753 0.01751 1.001 3422 0.3169 -0.01679 0.05185
fixed NA birth_order_nonlinear3 0.01558 0.02045 0.7616 3503 0.4464 -0.02451 0.05566
fixed NA birth_order_nonlinear4 -0.00005851 0.0242 -0.002418 3563 0.9981 -0.04749 0.04737
fixed NA birth_order_nonlinear5 -0.002062 0.02949 -0.06994 3572 0.9442 -0.05986 0.05573
fixed NA birth_order_nonlinear>5 0.002764 0.02752 0.1004 3836 0.92 -0.05118 0.05671
ran_pars mother_pidlink sd__(Intercept) 0.1585 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3722 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.904 0.2612 3.46 3831 0.0005452 0.392 1.416
fixed NA poly(age, 3, raw = TRUE)1 -0.1033 0.02807 -3.68 3829 0.0002365 -0.1583 -0.04828
fixed NA poly(age, 3, raw = TRUE)2 0.004077 0.0009634 4.233 3828 0.00002364 0.002189 0.005966
fixed NA poly(age, 3, raw = TRUE)3 -0.00004555 0.00001058 -4.305 3827 0.00001715 -0.00006629 -0.00002481
fixed NA male -0.02482 0.01313 -1.89 3795 0.05884 -0.05057 0.0009199
fixed NA count_birth_order2/2 0.07947 0.03699 2.148 3581 0.03176 0.006965 0.152
fixed NA count_birth_order1/3 0.02032 0.0316 0.643 3818 0.5202 -0.04161 0.08225
fixed NA count_birth_order2/3 0.04303 0.03437 1.252 3830 0.2107 -0.02433 0.1104
fixed NA count_birth_order3/3 -0.015 0.03778 -0.3971 3833 0.6913 -0.08904 0.05904
fixed NA count_birth_order1/4 0.005795 0.03435 0.1687 3825 0.866 -0.06153 0.07312
fixed NA count_birth_order2/4 -0.0307 0.03584 -0.8566 3832 0.3917 -0.1009 0.03954
fixed NA count_birth_order3/4 -0.0108 0.03917 -0.2758 3830 0.7827 -0.08757 0.06596
fixed NA count_birth_order4/4 -0.006404 0.04181 -0.1532 3827 0.8783 -0.08835 0.07554
fixed NA count_birth_order1/5 0.01609 0.04117 0.3908 3833 0.6959 -0.0646 0.09678
fixed NA count_birth_order2/5 0.01692 0.04276 0.3957 3831 0.6924 -0.06688 0.1007
fixed NA count_birth_order3/5 0.01622 0.04352 0.3728 3825 0.7093 -0.06907 0.1015
fixed NA count_birth_order4/5 0.01776 0.04424 0.4013 3818 0.6882 -0.06896 0.1045
fixed NA count_birth_order5/5 0.02105 0.04457 0.4723 3817 0.6367 -0.0663 0.1084
fixed NA count_birth_order1/>5 0.03557 0.03723 0.9554 3832 0.3394 -0.0374 0.1085
fixed NA count_birth_order2/>5 0.04765 0.03933 1.211 3824 0.2258 -0.02944 0.1247
fixed NA count_birth_order3/>5 0.1171 0.03789 3.092 3824 0.002004 0.04288 0.1914
fixed NA count_birth_order4/>5 0.03739 0.03695 1.012 3821 0.3117 -0.03504 0.1098
fixed NA count_birth_order5/>5 0.03913 0.03908 1.001 3808 0.3167 -0.03746 0.1157
fixed NA count_birth_order>5/>5 0.05174 0.02961 1.747 3707 0.08067 -0.006299 0.1098
ran_pars mother_pidlink sd__(Intercept) 0.1582 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3723 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 3939 4008 -1958 3917 NA NA NA
12 3941 4016 -1958 3917 0.01549 1 0.901
16 3947 4047 -1958 3915 1.543 4 0.8189
26 3955 4118 -1952 3903 11.8 10 0.2988

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9712 0.2646 3.67 3751 0.0002462 0.4525 1.49
fixed NA poly(age, 3, raw = TRUE)1 -0.11 0.02846 -3.864 3749 0.0001135 -0.1657 -0.05418
fixed NA poly(age, 3, raw = TRUE)2 0.004334 0.0009771 4.435 3746 0.000009468 0.002418 0.006249
fixed NA poly(age, 3, raw = TRUE)3 -0.00004871 0.00001074 -4.536 3745 0.000005926 -0.00006976 -0.00002766
fixed NA male -0.02276 0.0133 -1.711 3715 0.08719 -0.04883 0.003314
fixed NA sibling_count3 0.02252 0.02157 1.044 3069 0.2966 -0.01976 0.06479
fixed NA sibling_count4 -0.02657 0.02265 -1.173 2884 0.2409 -0.07097 0.01783
fixed NA sibling_count5 0.03133 0.02594 1.208 2547 0.2273 -0.01952 0.08218
fixed NA sibling_count>5 0.04105 0.02217 1.852 2545 0.06416 -0.002396 0.0845
ran_pars mother_pidlink sd__(Intercept) 0.16 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3726 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9698 0.2647 3.663 3751 0.0002524 0.4509 1.489
fixed NA birth_order -0.001067 0.004238 -0.2517 3715 0.8013 -0.009373 0.007239
fixed NA poly(age, 3, raw = TRUE)1 -0.1097 0.02848 -3.851 3749 0.0001198 -0.1655 -0.05385
fixed NA poly(age, 3, raw = TRUE)2 0.004326 0.0009776 4.425 3747 0.000009919 0.00241 0.006242
fixed NA poly(age, 3, raw = TRUE)3 -0.00004867 0.00001074 -4.531 3745 0.000006041 -0.00006973 -0.00002762
fixed NA male -0.02275 0.0133 -1.71 3713 0.0874 -0.04882 0.00333
fixed NA sibling_count3 0.02308 0.02169 1.064 3067 0.2874 -0.01943 0.0656
fixed NA sibling_count4 -0.02539 0.02314 -1.097 2891 0.2725 -0.07074 0.01996
fixed NA sibling_count5 0.03322 0.02704 1.229 2589 0.2193 -0.01977 0.08622
fixed NA sibling_count>5 0.0449 0.02695 1.666 2763 0.09583 -0.007923 0.09772
ran_pars mother_pidlink sd__(Intercept) 0.1602 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3725 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9616 0.2651 3.628 3747 0.0002899 0.4421 1.481
fixed NA poly(age, 3, raw = TRUE)1 -0.1091 0.0285 -3.828 3744 0.0001314 -0.165 -0.05323
fixed NA poly(age, 3, raw = TRUE)2 0.00431 0.0009784 4.405 3742 0.00001088 0.002392 0.006227
fixed NA poly(age, 3, raw = TRUE)3 -0.00004859 0.00001075 -4.519 3740 0.000006417 -0.00006966 -0.00002751
fixed NA male -0.02281 0.01331 -1.713 3710 0.08675 -0.0489 0.003284
fixed NA sibling_count3 0.02313 0.02213 1.045 3157 0.296 -0.02025 0.06651
fixed NA sibling_count4 -0.02585 0.02394 -1.08 3054 0.2803 -0.07278 0.02107
fixed NA sibling_count5 0.03196 0.02818 1.134 2816 0.2569 -0.02328 0.08719
fixed NA sibling_count>5 0.05248 0.02768 1.896 2897 0.05807 -0.001773 0.1067
fixed NA birth_order_nonlinear2 0.004606 0.01724 0.2672 3285 0.7893 -0.02918 0.03839
fixed NA birth_order_nonlinear3 -0.001029 0.02041 -0.0504 3362 0.9598 -0.04103 0.03897
fixed NA birth_order_nonlinear4 0.001722 0.02559 0.06727 3422 0.9464 -0.04844 0.05189
fixed NA birth_order_nonlinear5 0.003465 0.03152 0.1099 3399 0.9125 -0.05832 0.06525
fixed NA birth_order_nonlinear>5 -0.02943 0.03147 -0.9352 3747 0.3498 -0.09112 0.03225
ran_pars mother_pidlink sd__(Intercept) 0.1602 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3727 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9503 0.266 3.573 3737 0.000358 0.429 1.472
fixed NA poly(age, 3, raw = TRUE)1 -0.1092 0.0286 -3.819 3735 0.0001361 -0.1653 -0.05318
fixed NA poly(age, 3, raw = TRUE)2 0.004316 0.0009823 4.394 3733 0.00001143 0.002391 0.006241
fixed NA poly(age, 3, raw = TRUE)3 -0.00004867 0.0000108 -4.507 3732 0.000006766 -0.00006983 -0.00002751
fixed NA male -0.0234 0.01334 -1.754 3699 0.07946 -0.04954 0.002743
fixed NA count_birth_order2/2 0.0426 0.03271 1.302 3378 0.193 -0.02152 0.1067
fixed NA count_birth_order1/3 0.04535 0.0282 1.608 3724 0.1078 -0.009916 0.1006
fixed NA count_birth_order2/3 0.04406 0.03134 1.406 3738 0.1598 -0.01736 0.1055
fixed NA count_birth_order3/3 0.01164 0.03353 0.3472 3738 0.7285 -0.05408 0.07737
fixed NA count_birth_order1/4 -0.008358 0.03305 -0.2528 3736 0.8004 -0.07314 0.05643
fixed NA count_birth_order2/4 -0.04096 0.03452 -1.187 3739 0.2355 -0.1086 0.0267
fixed NA count_birth_order3/4 -0.01007 0.03618 -0.2784 3735 0.7807 -0.08097 0.06083
fixed NA count_birth_order4/4 0.02124 0.03901 0.5443 3731 0.5862 -0.05522 0.09769
fixed NA count_birth_order1/5 0.0574 0.04322 1.328 3739 0.1842 -0.02731 0.1421
fixed NA count_birth_order2/5 0.07243 0.04845 1.495 3715 0.1351 -0.02254 0.1674
fixed NA count_birth_order3/5 0.0487 0.04642 1.049 3719 0.2941 -0.04227 0.1397
fixed NA count_birth_order4/5 0.03821 0.04477 0.8534 3722 0.3935 -0.04954 0.126
fixed NA count_birth_order5/5 0.0122 0.04712 0.2589 3717 0.7957 -0.08016 0.1046
fixed NA count_birth_order1/>5 0.05652 0.0421 1.342 3735 0.1795 -0.026 0.139
fixed NA count_birth_order2/>5 0.05222 0.04261 1.225 3719 0.2205 -0.0313 0.1357
fixed NA count_birth_order3/>5 0.09224 0.04079 2.261 3719 0.02382 0.01228 0.1722
fixed NA count_birth_order4/>5 0.03775 0.04057 0.9304 3703 0.3522 -0.04177 0.1173
fixed NA count_birth_order5/>5 0.0893 0.0384 2.326 3713 0.02009 0.01404 0.1646
fixed NA count_birth_order>5/>5 0.0354 0.0301 1.176 3588 0.2396 -0.02359 0.09438
ran_pars mother_pidlink sd__(Intercept) 0.1598 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3729 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 3861 3930 -1919 3839 NA NA NA
12 3863 3938 -1919 3839 0.06169 1 0.8038
16 3870 3969 -1919 3838 1.332 4 0.856
26 3882 4044 -1915 3830 8.08 10 0.6211

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Work Category

Category_Casual worker in agriculture

birthorder <- birthorder %>% mutate(outcome = `Category_Casual worker in agriculture`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.06852 0.03525 1.944 9844 0.05195 -0.0005704 0.1376
fixed NA poly(age, 3, raw = TRUE)1 -0.004585 0.003161 -1.45 9771 0.147 -0.01078 0.001611
fixed NA poly(age, 3, raw = TRUE)2 0.0001275 0.00008876 1.437 9635 0.1508 -0.00004643 0.0003015
fixed NA poly(age, 3, raw = TRUE)3 -0.0000009703 0.0000007884 -1.231 9480 0.2185 -0.000002516 0.000000575
fixed NA male 0.0003999 0.003258 0.1228 9985 0.9023 -0.005985 0.006785
fixed NA sibling_count3 -0.00296 0.006763 -0.4378 7181 0.6616 -0.01622 0.01029
fixed NA sibling_count4 0.005901 0.00682 0.8653 6742 0.3869 -0.007465 0.01927
fixed NA sibling_count5 -0.002795 0.007104 -0.3935 6243 0.694 -0.01672 0.01113
fixed NA sibling_count>5 0.008566 0.005512 1.554 7041 0.1202 -0.002237 0.01937
ran_pars mother_pidlink sd__(Intercept) 0.05392 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1531 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.06862 0.03525 1.947 9843 0.05159 -0.0004662 0.1377
fixed NA birth_order -0.0009169 0.0006614 -1.386 8785 0.1657 -0.002213 0.0003793
fixed NA poly(age, 3, raw = TRUE)1 -0.004333 0.003167 -1.368 9760 0.1712 -0.01054 0.001873
fixed NA poly(age, 3, raw = TRUE)2 0.0001183 0.00008901 1.329 9591 0.1837 -0.00005613 0.0002928
fixed NA poly(age, 3, raw = TRUE)3 -0.0000008869 0.0000007907 -1.122 9419 0.262 -0.000002437 0.0000006629
fixed NA male 0.0004145 0.003257 0.1273 9983 0.8987 -0.00597 0.006799
fixed NA sibling_count3 -0.00271 0.006766 -0.4005 7190 0.6888 -0.01597 0.01055
fixed NA sibling_count4 0.006467 0.006833 0.9464 6790 0.344 -0.006925 0.01986
fixed NA sibling_count5 -0.001804 0.007141 -0.2526 6335 0.8006 -0.0158 0.01219
fixed NA sibling_count>5 0.01179 0.005981 1.971 7847 0.04878 0.00006478 0.02351
ran_pars mother_pidlink sd__(Intercept) 0.05405 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.153 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.0684 0.03531 1.937 9847 0.05273 -0.000797 0.1376
fixed NA poly(age, 3, raw = TRUE)1 -0.004322 0.00317 -1.364 9763 0.1727 -0.01053 0.001891
fixed NA poly(age, 3, raw = TRUE)2 0.0001208 0.00008907 1.357 9596 0.1749 -0.00005374 0.0002954
fixed NA poly(age, 3, raw = TRUE)3 -0.0000009306 0.0000007912 -1.176 9420 0.2396 -0.000002481 0.0000006201
fixed NA male 0.0004062 0.003258 0.1247 9979 0.9008 -0.00598 0.006792
fixed NA sibling_count3 -0.002613 0.006868 -0.3805 7465 0.7036 -0.01607 0.01085
fixed NA sibling_count4 0.007246 0.007019 1.032 7292 0.302 -0.006511 0.021
fixed NA sibling_count5 -0.001002 0.007388 -0.1356 6974 0.8921 -0.01548 0.01348
fixed NA sibling_count>5 0.01129 0.006267 1.801 8560 0.07178 -0.0009978 0.02357
fixed NA birth_order_nonlinear2 -0.00616 0.004749 -1.297 9156 0.1946 -0.01547 0.003147
fixed NA birth_order_nonlinear3 -0.003442 0.00552 -0.6236 8982 0.5329 -0.01426 0.007377
fixed NA birth_order_nonlinear4 -0.008114 0.006198 -1.309 9085 0.1905 -0.02026 0.004034
fixed NA birth_order_nonlinear5 -0.006216 0.006973 -0.8915 9127 0.3727 -0.01988 0.007451
fixed NA birth_order_nonlinear>5 -0.006247 0.005788 -1.079 10081 0.2805 -0.01759 0.005097
ran_pars mother_pidlink sd__(Intercept) 0.05398 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1531 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.07183 0.03542 2.028 9850 0.0426 0.002406 0.1413
fixed NA poly(age, 3, raw = TRUE)1 -0.004317 0.003172 -1.361 9752 0.1735 -0.01053 0.001899
fixed NA poly(age, 3, raw = TRUE)2 0.0001217 0.0000891 1.366 9583 0.1721 -0.00005296 0.0002963
fixed NA poly(age, 3, raw = TRUE)3 -0.0000009483 0.0000007913 -1.198 9403 0.2308 -0.000002499 0.0000006027
fixed NA male 0.0003518 0.003259 0.1079 9970 0.914 -0.006036 0.00674
fixed NA count_birth_order2/2 -0.01611 0.009432 -1.708 9035 0.08768 -0.03459 0.002377
fixed NA count_birth_order1/3 -0.007027 0.009116 -0.7708 9982 0.4408 -0.02489 0.01084
fixed NA count_birth_order2/3 -0.006682 0.0101 -0.6613 10024 0.5084 -0.02649 0.01312
fixed NA count_birth_order3/3 -0.01617 0.0111 -1.457 10049 0.1452 -0.03792 0.005584
fixed NA count_birth_order1/4 -0.007734 0.009987 -0.7744 10027 0.4387 -0.02731 0.01184
fixed NA count_birth_order2/4 -0.003666 0.01071 -0.3423 10042 0.7321 -0.02465 0.01732
fixed NA count_birth_order3/4 0.01068 0.01142 0.935 10059 0.3498 -0.0117 0.03305
fixed NA count_birth_order4/4 0.00423 0.01213 0.3488 10064 0.7273 -0.01954 0.028
fixed NA count_birth_order1/5 0.002099 0.01134 0.1851 10058 0.8531 -0.02013 0.02433
fixed NA count_birth_order2/5 -0.01472 0.01203 -1.224 10064 0.2208 -0.03829 0.008845
fixed NA count_birth_order3/5 -0.02292 0.01266 -1.81 10069 0.07029 -0.04773 0.001896
fixed NA count_birth_order4/5 0.003402 0.01331 0.2556 10069 0.7982 -0.02268 0.02948
fixed NA count_birth_order5/5 -0.01578 0.0133 -1.186 10071 0.2356 -0.04186 0.01029
fixed NA count_birth_order1/>5 0.007944 0.008735 0.9094 10069 0.3632 -0.009177 0.02506
fixed NA count_birth_order2/>5 0.004563 0.009098 0.5016 10071 0.616 -0.01327 0.02239
fixed NA count_birth_order3/>5 0.007596 0.008963 0.8475 10071 0.3967 -0.009971 0.02516
fixed NA count_birth_order4/>5 -0.008504 0.008802 -0.9661 10070 0.334 -0.02576 0.008748
fixed NA count_birth_order5/>5 0.002768 0.008901 0.311 10071 0.7558 -0.01468 0.02021
fixed NA count_birth_order>5/>5 0.001264 0.007196 0.1757 9110 0.8605 -0.01284 0.01537
ran_pars mother_pidlink sd__(Intercept) 0.05386 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1531 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -8128 -8049 4075 -8150 NA NA NA
12 -8128 -8041 4076 -8152 1.92 1 0.1659
16 -8121 -8005 4076 -8153 0.7708 4 0.9423
26 -8114 -7926 4083 -8166 13.04 10 0.2216

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01952 0.07867 0.2481 3803 0.804 -0.1347 0.1737
fixed NA poly(age, 3, raw = TRUE)1 0.001255 0.008445 0.1486 3791 0.8819 -0.0153 0.01781
fixed NA poly(age, 3, raw = TRUE)2 -0.0001097 0.0002896 -0.3787 3781 0.7049 -0.0006773 0.000458
fixed NA poly(age, 3, raw = TRUE)3 0.000001805 0.000003179 0.5676 3774 0.5703 -0.000004427 0.000008036
fixed NA male 0.003915 0.003952 0.9909 3702 0.3218 -0.003829 0.01166
fixed NA sibling_count3 -0.005883 0.006687 -0.8798 2731 0.3791 -0.01899 0.007224
fixed NA sibling_count4 0.0002679 0.006935 0.03863 2527 0.9692 -0.01332 0.01386
fixed NA sibling_count5 -0.007085 0.007746 -0.9147 2239 0.3605 -0.02227 0.008096
fixed NA sibling_count>5 0.01689 0.006728 2.51 2229 0.01213 0.003703 0.03008
ran_pars mother_pidlink sd__(Intercept) 0.05521 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1091 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.02063 0.07869 0.2622 3804 0.7932 -0.1336 0.1749
fixed NA birth_order 0.0009961 0.001241 0.803 3794 0.422 -0.001435 0.003427
fixed NA poly(age, 3, raw = TRUE)1 0.001006 0.008451 0.119 3795 0.9053 -0.01556 0.01757
fixed NA poly(age, 3, raw = TRUE)2 -0.0001032 0.0002898 -0.3563 3784 0.7216 -0.0006711 0.0004647
fixed NA poly(age, 3, raw = TRUE)3 0.000001779 0.00000318 0.5595 3775 0.5759 -0.000004453 0.000008011
fixed NA male 0.003886 0.003952 0.9833 3702 0.3255 -0.00386 0.01163
fixed NA sibling_count3 -0.006403 0.006718 -0.953 2736 0.3407 -0.01957 0.006765
fixed NA sibling_count4 -0.0008584 0.007075 -0.1213 2539 0.9034 -0.01473 0.01301
fixed NA sibling_count5 -0.008934 0.00808 -1.106 2304 0.269 -0.02477 0.006903
fixed NA sibling_count>5 0.01326 0.008107 1.635 2458 0.1022 -0.002634 0.02915
ran_pars mother_pidlink sd__(Intercept) 0.05515 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1091 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.02295 0.07878 0.2913 3800 0.7709 -0.1315 0.1773
fixed NA poly(age, 3, raw = TRUE)1 0.0008336 0.008454 0.0986 3788 0.9215 -0.01574 0.0174
fixed NA poly(age, 3, raw = TRUE)2 -0.0000993 0.0002899 -0.3425 3777 0.732 -0.0006675 0.0004689
fixed NA poly(age, 3, raw = TRUE)3 0.000001774 0.000003182 0.5574 3768 0.5773 -0.000004463 0.00000801
fixed NA male 0.003896 0.003953 0.9856 3697 0.3244 -0.003851 0.01164
fixed NA sibling_count3 -0.005982 0.006841 -0.8744 2856 0.382 -0.01939 0.007427
fixed NA sibling_count4 -0.0002267 0.007308 -0.03102 2746 0.9753 -0.01455 0.0141
fixed NA sibling_count5 -0.00734 0.008432 -0.8706 2585 0.3841 -0.02387 0.009185
fixed NA sibling_count>5 0.01131 0.008306 1.361 2609 0.1736 -0.004973 0.02758
fixed NA birth_order_nonlinear2 0.002468 0.005159 0.4784 3041 0.6324 -0.007644 0.01258
fixed NA birth_order_nonlinear3 0.0001147 0.006077 0.01887 3134 0.9849 -0.0118 0.01203
fixed NA birth_order_nonlinear4 0.001705 0.007413 0.23 3210 0.8181 -0.01282 0.01623
fixed NA birth_order_nonlinear5 -0.0005972 0.009118 -0.06549 3207 0.9478 -0.01847 0.01727
fixed NA birth_order_nonlinear>5 0.0157 0.009163 1.713 3794 0.0868 -0.002263 0.03365
ran_pars mother_pidlink sd__(Intercept) 0.05527 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1091 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.02181 0.07903 0.276 3792 0.7826 -0.1331 0.1767
fixed NA poly(age, 3, raw = TRUE)1 0.001327 0.008482 0.1565 3782 0.8756 -0.0153 0.01795
fixed NA poly(age, 3, raw = TRUE)2 -0.0001173 0.0002909 -0.4032 3773 0.6868 -0.0006875 0.0004529
fixed NA poly(age, 3, raw = TRUE)3 0.00000199 0.000003194 0.6231 3766 0.5333 -0.00000427 0.000008251
fixed NA male 0.003913 0.003957 0.989 3692 0.3227 -0.003842 0.01167
fixed NA count_birth_order2/2 -0.007885 0.01004 -0.785 3256 0.4325 -0.02757 0.0118
fixed NA count_birth_order1/3 -0.01161 0.008624 -1.346 3766 0.1784 -0.02851 0.005296
fixed NA count_birth_order2/3 -0.009642 0.009564 -1.008 3802 0.3134 -0.02839 0.009103
fixed NA count_birth_order3/3 -0.001103 0.01033 -0.1067 3807 0.915 -0.02136 0.01915
fixed NA count_birth_order1/4 0.001448 0.009895 0.1463 3796 0.8837 -0.01795 0.02084
fixed NA count_birth_order2/4 -0.001238 0.01039 -0.1191 3807 0.9052 -0.02161 0.01913
fixed NA count_birth_order3/4 -0.0139 0.01089 -1.277 3798 0.2019 -0.03524 0.007441
fixed NA count_birth_order4/4 0.002229 0.01154 0.1931 3792 0.8469 -0.0204 0.02486
fixed NA count_birth_order1/5 -0.009352 0.01296 -0.7215 3806 0.4706 -0.03475 0.01605
fixed NA count_birth_order2/5 -0.01508 0.01408 -1.071 3760 0.2842 -0.04266 0.01251
fixed NA count_birth_order3/5 -0.01413 0.01319 -1.071 3774 0.2844 -0.03998 0.01173
fixed NA count_birth_order4/5 0.002559 0.01283 0.1994 3773 0.842 -0.02259 0.02771
fixed NA count_birth_order5/5 -0.01591 0.01345 -1.183 3763 0.2371 -0.04227 0.01046
fixed NA count_birth_order1/>5 -0.00645 0.01232 -0.5237 3793 0.6005 -0.03059 0.01769
fixed NA count_birth_order2/>5 0.03205 0.01241 2.582 3757 0.00986 0.007722 0.05638
fixed NA count_birth_order3/>5 0.01239 0.01213 1.022 3748 0.3071 -0.01138 0.03617
fixed NA count_birth_order4/>5 -0.003848 0.01178 -0.3267 3732 0.7439 -0.02693 0.01924
fixed NA count_birth_order5/>5 0.01032 0.01136 0.9085 3749 0.3637 -0.01195 0.03259
fixed NA count_birth_order>5/>5 0.02363 0.008944 2.642 3613 0.008276 0.006101 0.04116
ran_pars mother_pidlink sd__(Intercept) 0.05466 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1093 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -5280 -5211 2651 -5302 NA NA NA
12 -5279 -5203 2651 -5303 0.6479 1 0.4209
16 -5274 -5174 2653 -5306 3.207 4 0.5238
26 -5268 -5106 2660 -5320 14.78 10 0.1402

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01131 0.0782 0.1446 3830 0.885 -0.142 0.1646
fixed NA poly(age, 3, raw = TRUE)1 0.002056 0.008402 0.2447 3819 0.8067 -0.01441 0.01852
fixed NA poly(age, 3, raw = TRUE)2 -0.0001338 0.0002882 -0.4642 3809 0.6425 -0.0006987 0.0004311
fixed NA poly(age, 3, raw = TRUE)3 0.000002068 0.000003165 0.6536 3802 0.5134 -0.000004134 0.000008271
fixed NA male 0.003961 0.003931 1.007 3729 0.3138 -0.003744 0.01167
fixed NA sibling_count3 -0.003733 0.007306 -0.5109 2825 0.6094 -0.01805 0.01059
fixed NA sibling_count4 -0.002881 0.007382 -0.3903 2681 0.6964 -0.01735 0.01159
fixed NA sibling_count5 -0.005224 0.007806 -0.6693 2471 0.5034 -0.02052 0.01007
fixed NA sibling_count>5 0.00942 0.006833 1.379 2566 0.1682 -0.003973 0.02281
ran_pars mother_pidlink sd__(Intercept) 0.05499 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1089 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01302 0.07819 0.1665 3831 0.8678 -0.1402 0.1663
fixed NA birth_order 0.001766 0.001094 1.613 3737 0.1068 -0.0003795 0.003911
fixed NA poly(age, 3, raw = TRUE)1 0.001647 0.008404 0.1959 3822 0.8447 -0.01483 0.01812
fixed NA poly(age, 3, raw = TRUE)2 -0.0001235 0.0002882 -0.4285 3812 0.6683 -0.0006885 0.0004414
fixed NA poly(age, 3, raw = TRUE)3 0.000002037 0.000003164 0.6439 3803 0.5197 -0.000004164 0.000008239
fixed NA male 0.003919 0.003931 0.997 3730 0.3188 -0.003785 0.01162
fixed NA sibling_count3 -0.004682 0.007326 -0.6391 2826 0.5228 -0.01904 0.009677
fixed NA sibling_count4 -0.004751 0.007469 -0.6361 2677 0.5248 -0.01939 0.009888
fixed NA sibling_count5 -0.00828 0.008028 -1.031 2492 0.3025 -0.02402 0.007456
fixed NA sibling_count>5 0.00311 0.00787 0.3951 2663 0.6928 -0.01232 0.01853
ran_pars mother_pidlink sd__(Intercept) 0.0548 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.109 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01294 0.07828 0.1654 3828 0.8687 -0.1405 0.1664
fixed NA poly(age, 3, raw = TRUE)1 0.001859 0.008409 0.2211 3817 0.825 -0.01462 0.01834
fixed NA poly(age, 3, raw = TRUE)2 -0.0001321 0.0002884 -0.4581 3807 0.6469 -0.0006975 0.0004332
fixed NA poly(age, 3, raw = TRUE)3 0.00000215 0.000003167 0.6788 3799 0.4973 -0.000004058 0.000008357
fixed NA male 0.003953 0.003932 1.005 3726 0.3148 -0.003754 0.01166
fixed NA sibling_count3 -0.003594 0.007444 -0.4828 2922 0.6293 -0.01818 0.011
fixed NA sibling_count4 -0.002937 0.007673 -0.3828 2839 0.7019 -0.01798 0.0121
fixed NA sibling_count5 -0.006432 0.008351 -0.7703 2731 0.4412 -0.0228 0.009935
fixed NA sibling_count>5 0.00298 0.008078 0.3689 2818 0.7122 -0.01285 0.01881
fixed NA birth_order_nonlinear2 0.002136 0.005222 0.409 3118 0.6826 -0.008099 0.01237
fixed NA birth_order_nonlinear3 -0.001164 0.006104 -0.1907 3223 0.8488 -0.01313 0.0108
fixed NA birth_order_nonlinear4 0.0004516 0.007227 0.06249 3307 0.9502 -0.01371 0.01462
fixed NA birth_order_nonlinear5 0.006838 0.008807 0.7765 3312 0.4375 -0.01042 0.0241
fixed NA birth_order_nonlinear>5 0.01633 0.008275 1.974 3843 0.0485 0.0001131 0.03255
ran_pars mother_pidlink sd__(Intercept) 0.05469 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1091 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01009 0.07847 0.1286 3820 0.8977 -0.1437 0.1639
fixed NA poly(age, 3, raw = TRUE)1 0.002548 0.008429 0.3022 3811 0.7625 -0.01397 0.01907
fixed NA poly(age, 3, raw = TRUE)2 -0.0001574 0.0002892 -0.5441 3803 0.5864 -0.0007243 0.0004095
fixed NA poly(age, 3, raw = TRUE)3 0.000002441 0.000003177 0.7684 3797 0.4423 -0.000003785 0.000008668
fixed NA male 0.003936 0.003938 0.9995 3720 0.3176 -0.003783 0.01166
fixed NA count_birth_order2/2 -0.007212 0.01106 -0.6522 3418 0.5143 -0.02889 0.01446
fixed NA count_birth_order1/3 -0.008172 0.009511 -0.8592 3794 0.3903 -0.02681 0.01047
fixed NA count_birth_order2/3 -0.009063 0.01034 -0.8768 3825 0.3807 -0.02932 0.0112
fixed NA count_birth_order3/3 0.001455 0.01135 0.1282 3833 0.898 -0.0208 0.02371
fixed NA count_birth_order1/4 0.0004717 0.01034 0.04564 3814 0.9636 -0.01979 0.02073
fixed NA count_birth_order2/4 -0.007483 0.01077 -0.6945 3832 0.4874 -0.0286 0.01363
fixed NA count_birth_order3/4 -0.01528 0.01176 -1.298 3826 0.1942 -0.03833 0.007783
fixed NA count_birth_order4/4 -0.001979 0.01256 -0.1576 3818 0.8748 -0.02659 0.02263
fixed NA count_birth_order1/5 -0.01023 0.01238 -0.8266 3833 0.4085 -0.03449 0.01403
fixed NA count_birth_order2/5 -0.007519 0.01284 -0.5854 3826 0.5583 -0.03269 0.01765
fixed NA count_birth_order3/5 -0.0147 0.01307 -1.125 3812 0.2606 -0.04031 0.01091
fixed NA count_birth_order4/5 0.00125 0.01328 0.09417 3794 0.925 -0.02477 0.02728
fixed NA count_birth_order5/5 -0.007193 0.01338 -0.5377 3795 0.5908 -0.03341 0.01902
fixed NA count_birth_order1/>5 -0.0104 0.01119 -0.9288 3833 0.3531 -0.03233 0.01154
fixed NA count_birth_order2/>5 0.02034 0.01181 1.723 3804 0.08504 -0.002802 0.04349
fixed NA count_birth_order3/>5 -0.0001227 0.01137 -0.01078 3808 0.9914 -0.02242 0.02217
fixed NA count_birth_order4/>5 -0.007947 0.01109 -0.7164 3803 0.4738 -0.02969 0.01379
fixed NA count_birth_order5/>5 0.009955 0.01172 0.8491 3772 0.3959 -0.01302 0.03293
fixed NA count_birth_order>5/>5 0.01644 0.008933 1.84 3643 0.06586 -0.001072 0.03395
ran_pars mother_pidlink sd__(Intercept) 0.05419 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1092 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -5331 -5262 2676 -5353 NA NA NA
12 -5332 -5256 2678 -5356 2.611 1 0.1061
16 -5326 -5226 2679 -5358 2.522 4 0.6408
26 -5318 -5155 2685 -5370 11.59 10 0.3135

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.001325 0.07952 -0.01666 3737 0.9867 -0.1572 0.1545
fixed NA poly(age, 3, raw = TRUE)1 0.003218 0.008549 0.3765 3726 0.7066 -0.01354 0.01997
fixed NA poly(age, 3, raw = TRUE)2 -0.0001742 0.0002935 -0.5934 3716 0.5529 -0.0007494 0.000401
fixed NA poly(age, 3, raw = TRUE)3 0.00000248 0.000003225 0.7689 3709 0.442 -0.000003842 0.000008801
fixed NA male 0.003577 0.003991 0.8963 3640 0.3702 -0.004245 0.0114
fixed NA sibling_count3 -0.003884 0.006553 -0.5927 2720 0.5534 -0.01673 0.008959
fixed NA sibling_count4 0.002849 0.006893 0.4133 2508 0.6794 -0.01066 0.01636
fixed NA sibling_count5 -0.00005811 0.007916 -0.007341 2150 0.9941 -0.01557 0.01546
fixed NA sibling_count>5 0.01903 0.006764 2.814 2154 0.004938 0.005776 0.03229
ran_pars mother_pidlink sd__(Intercept) 0.05496 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1093 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.0002167 0.07955 -0.002724 3738 0.9978 -0.1561 0.1557
fixed NA birth_order 0.000822 0.001276 0.644 3738 0.5196 -0.00168 0.003324
fixed NA poly(age, 3, raw = TRUE)1 0.002991 0.008557 0.3496 3729 0.7267 -0.01378 0.01976
fixed NA poly(age, 3, raw = TRUE)2 -0.0001681 0.0002936 -0.5724 3719 0.5671 -0.0007436 0.0004075
fixed NA poly(age, 3, raw = TRUE)3 0.00000245 0.000003226 0.7596 3710 0.4475 -0.000003872 0.000008773
fixed NA male 0.003571 0.003991 0.8946 3640 0.371 -0.004252 0.01139
fixed NA sibling_count3 -0.004323 0.006588 -0.6561 2722 0.5118 -0.01724 0.00859
fixed NA sibling_count4 0.001934 0.007037 0.2748 2524 0.7835 -0.01186 0.01573
fixed NA sibling_count5 -0.001542 0.008244 -0.187 2206 0.8517 -0.0177 0.01462
fixed NA sibling_count>5 0.01604 0.008204 1.955 2429 0.05067 -0.00003848 0.03212
ran_pars mother_pidlink sd__(Intercept) 0.05492 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1093 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.004456 0.07962 0.05596 3734 0.9554 -0.1516 0.1605
fixed NA poly(age, 3, raw = TRUE)1 0.002493 0.008558 0.2913 3723 0.7708 -0.01428 0.01927
fixed NA poly(age, 3, raw = TRUE)2 -0.0001531 0.0002937 -0.5212 3713 0.6023 -0.0007288 0.0004226
fixed NA poly(age, 3, raw = TRUE)3 0.000002327 0.000003228 0.721 3705 0.4709 -0.000003999 0.000008653
fixed NA male 0.00353 0.003992 0.8844 3637 0.3766 -0.004294 0.01135
fixed NA sibling_count3 -0.003619 0.006713 -0.5391 2841 0.5898 -0.01678 0.009538
fixed NA sibling_count4 0.001897 0.007268 0.261 2725 0.7941 -0.01235 0.01614
fixed NA sibling_count5 -0.0000944 0.008571 -0.01101 2461 0.9912 -0.01689 0.01671
fixed NA sibling_count>5 0.01416 0.008412 1.684 2583 0.09233 -0.002323 0.03065
fixed NA birth_order_nonlinear2 0.003759 0.00514 0.7312 2983 0.4647 -0.006316 0.01383
fixed NA birth_order_nonlinear3 -0.001207 0.00609 -0.1982 3082 0.8429 -0.01314 0.01073
fixed NA birth_order_nonlinear4 0.006397 0.007642 0.837 3157 0.4027 -0.008582 0.02138
fixed NA birth_order_nonlinear5 -0.004586 0.009411 -0.4873 3113 0.6261 -0.02303 0.01386
fixed NA birth_order_nonlinear>5 0.01514 0.009452 1.602 3721 0.1093 -0.003388 0.03366
ran_pars mother_pidlink sd__(Intercept) 0.05481 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1094 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.001525 0.07984 0.0191 3727 0.9848 -0.155 0.158
fixed NA poly(age, 3, raw = TRUE)1 0.003193 0.008584 0.372 3717 0.7099 -0.01363 0.02002
fixed NA poly(age, 3, raw = TRUE)2 -0.0001795 0.0002947 -0.6092 3709 0.5424 -0.0007572 0.0003981
fixed NA poly(age, 3, raw = TRUE)3 0.000002647 0.000003239 0.817 3702 0.414 -0.000003703 0.000008996
fixed NA male 0.003806 0.003996 0.9523 3629 0.341 -0.004027 0.01164
fixed NA count_birth_order2/2 -0.00583 0.009763 -0.5971 3160 0.5505 -0.02497 0.01331
fixed NA count_birth_order1/3 -0.008914 0.008482 -1.051 3703 0.2933 -0.02554 0.00771
fixed NA count_birth_order2/3 -0.006944 0.009415 -0.7375 3738 0.4609 -0.0254 0.01151
fixed NA count_birth_order3/3 0.001039 0.01007 0.1032 3738 0.9178 -0.0187 0.02078
fixed NA count_birth_order1/4 0.005042 0.009935 0.5075 3732 0.6118 -0.01443 0.02451
fixed NA count_birth_order2/4 0.001827 0.01037 0.1762 3738 0.8602 -0.01849 0.02215
fixed NA count_birth_order3/4 -0.01081 0.01086 -0.9954 3729 0.3196 -0.03209 0.01047
fixed NA count_birth_order4/4 0.005862 0.01171 0.5008 3719 0.6165 -0.01708 0.0288
fixed NA count_birth_order1/5 -0.005219 0.01298 -0.4021 3739 0.6877 -0.03066 0.02022
fixed NA count_birth_order2/5 -0.001872 0.01453 -0.1289 3679 0.8975 -0.03035 0.0266
fixed NA count_birth_order3/5 -0.009697 0.01392 -0.6966 3689 0.4861 -0.03698 0.01758
fixed NA count_birth_order4/5 0.01645 0.01343 1.225 3699 0.2207 -0.00987 0.04277
fixed NA count_birth_order5/5 -0.01244 0.01413 -0.8801 3688 0.3789 -0.04013 0.01526
fixed NA count_birth_order1/>5 -0.003465 0.01264 -0.2742 3722 0.7839 -0.02823 0.0213
fixed NA count_birth_order2/>5 0.03849 0.01278 3.012 3682 0.00261 0.01345 0.06353
fixed NA count_birth_order3/>5 0.01002 0.01223 0.8194 3686 0.4126 -0.01395 0.034
fixed NA count_birth_order4/>5 0.006257 0.01216 0.5146 3651 0.6069 -0.01758 0.03009
fixed NA count_birth_order5/>5 0.009081 0.01151 0.7888 3678 0.4303 -0.01348 0.03165
fixed NA count_birth_order>5/>5 0.02622 0.009074 2.889 3535 0.003887 0.008431 0.044
ran_pars mother_pidlink sd__(Intercept) 0.05436 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1095 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -5181 -5113 2602 -5203 NA NA NA
12 -5180 -5105 2602 -5204 0.4171 1 0.5184
16 -5177 -5077 2604 -5209 4.736 4 0.3155
26 -5171 -5009 2611 -5223 14.04 10 0.171

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Category_Casual worker not in agriculture

birthorder <- birthorder %>% mutate(outcome = `Category_Casual worker not in agriculture`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2572 0.05886 4.37 9890 0.00001256 0.1418 0.3725
fixed NA poly(age, 3, raw = TRUE)1 -0.01623 0.00528 -3.074 9831 0.002114 -0.02658 -0.005884
fixed NA poly(age, 3, raw = TRUE)2 0.0003827 0.0001483 2.581 9715 0.009866 0.00009208 0.0006733
fixed NA poly(age, 3, raw = TRUE)3 -0.000002755 0.000001317 -2.092 9579 0.03649 -0.000005337 -0.0000001736
fixed NA male 0.06204 0.00543 11.43 9970 4.752e-30 0.0514 0.07269
fixed NA sibling_count3 0.002887 0.01133 0.2549 7371 0.7988 -0.01932 0.02509
fixed NA sibling_count4 -0.006908 0.01143 -0.6044 6971 0.5456 -0.02931 0.01549
fixed NA sibling_count5 -0.001617 0.01191 -0.1358 6507 0.892 -0.02496 0.02173
fixed NA sibling_count>5 -0.007001 0.009233 -0.7582 7251 0.4483 -0.0251 0.0111
ran_pars mother_pidlink sd__(Intercept) 0.09542 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2537 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2572 0.05886 4.37 9889 0.00001255 0.1419 0.3726
fixed NA birth_order -0.0001545 0.001106 -0.1397 9078 0.8889 -0.002322 0.002013
fixed NA poly(age, 3, raw = TRUE)1 -0.01619 0.005289 -3.061 9821 0.002211 -0.02656 -0.005824
fixed NA poly(age, 3, raw = TRUE)2 0.0003811 0.0001487 2.563 9676 0.0104 0.00008966 0.0006725
fixed NA poly(age, 3, raw = TRUE)3 -0.000002741 0.000001321 -2.075 9523 0.03805 -0.000005331 -0.0000001514
fixed NA male 0.06205 0.00543 11.43 9968 4.761e-30 0.0514 0.07269
fixed NA sibling_count3 0.002928 0.01133 0.2583 7381 0.7962 -0.01928 0.02514
fixed NA sibling_count4 -0.006814 0.01145 -0.5951 7017 0.5518 -0.02925 0.01563
fixed NA sibling_count5 -0.00145 0.01197 -0.1212 6596 0.9036 -0.02491 0.02201
fixed NA sibling_count>5 -0.00646 0.01001 -0.6453 8025 0.5187 -0.02608 0.01316
ran_pars mother_pidlink sd__(Intercept) 0.09546 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2537 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2574 0.05896 4.367 9892 0.00001275 0.1419 0.373
fixed NA poly(age, 3, raw = TRUE)1 -0.0162 0.005294 -3.06 9823 0.002222 -0.02657 -0.005822
fixed NA poly(age, 3, raw = TRUE)2 0.0003819 0.0001488 2.567 9680 0.01028 0.00009029 0.0006736
fixed NA poly(age, 3, raw = TRUE)3 -0.000002754 0.000001322 -2.083 9524 0.0373 -0.000005345 -0.0000001623
fixed NA male 0.06205 0.005432 11.42 9965 4.87e-30 0.05141 0.0727
fixed NA sibling_count3 0.003057 0.0115 0.2658 7639 0.7904 -0.01948 0.0256
fixed NA sibling_count4 -0.006794 0.01176 -0.578 7490 0.5633 -0.02984 0.01625
fixed NA sibling_count5 -0.0008552 0.01238 -0.0691 7200 0.9449 -0.02512 0.0234
fixed NA sibling_count>5 -0.006345 0.01048 -0.6053 8677 0.545 -0.02689 0.0142
fixed NA birth_order_nonlinear2 -0.00146 0.007906 -0.1847 9227 0.8535 -0.01696 0.01404
fixed NA birth_order_nonlinear3 -0.001161 0.009188 -0.1263 9055 0.8995 -0.01917 0.01685
fixed NA birth_order_nonlinear4 -0.0003736 0.01032 -0.03621 9142 0.9711 -0.0206 0.01985
fixed NA birth_order_nonlinear5 -0.004592 0.01161 -0.3955 9173 0.6925 -0.02734 0.01816
fixed NA birth_order_nonlinear>5 -0.0009382 0.009655 -0.09716 10078 0.9226 -0.01986 0.01799
ran_pars mother_pidlink sd__(Intercept) 0.09536 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2537 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2538 0.05915 4.291 9894 0.00001795 0.1379 0.3697
fixed NA poly(age, 3, raw = TRUE)1 -0.01604 0.005297 -3.028 9813 0.002465 -0.02642 -0.00566
fixed NA poly(age, 3, raw = TRUE)2 0.000377 0.0001488 2.533 9667 0.01133 0.00008526 0.0006687
fixed NA poly(age, 3, raw = TRUE)3 -0.000002706 0.000001322 -2.046 9508 0.04074 -0.000005298 -0.0000001144
fixed NA male 0.06207 0.005433 11.42 9955 4.852e-30 0.05142 0.07272
fixed NA count_birth_order2/2 0.004305 0.0157 0.2742 9148 0.7839 -0.02646 0.03507
fixed NA count_birth_order1/3 0.008432 0.01522 0.5541 9975 0.5795 -0.02139 0.03826
fixed NA count_birth_order2/3 0.00825 0.01686 0.4892 10021 0.6247 -0.0248 0.0413
fixed NA count_birth_order3/3 -0.008015 0.01852 -0.4328 10049 0.6652 -0.04431 0.02828
fixed NA count_birth_order1/4 -0.0248 0.01667 -1.488 10023 0.1368 -0.05747 0.007867
fixed NA count_birth_order2/4 0.007322 0.01787 0.4098 10041 0.682 -0.0277 0.04235
fixed NA count_birth_order3/4 0.01171 0.01905 0.6149 10059 0.5386 -0.02562 0.04905
fixed NA count_birth_order4/4 -0.009058 0.02023 -0.4477 10065 0.6544 -0.04872 0.0306
fixed NA count_birth_order1/5 -0.01351 0.01892 -0.7138 10057 0.4754 -0.05059 0.02358
fixed NA count_birth_order2/5 -0.01094 0.02006 -0.5453 10064 0.5856 -0.05026 0.02838
fixed NA count_birth_order3/5 0.02642 0.02112 1.251 10069 0.2109 -0.01497 0.06782
fixed NA count_birth_order4/5 0.01116 0.0222 0.5028 10068 0.6151 -0.03235 0.05466
fixed NA count_birth_order5/5 -0.006309 0.02219 -0.2843 10071 0.7762 -0.04981 0.03719
fixed NA count_birth_order1/>5 0.01452 0.01457 0.9961 10069 0.3192 -0.01405 0.04308
fixed NA count_birth_order2/>5 -0.01502 0.01518 -0.9897 10071 0.3224 -0.04477 0.01473
fixed NA count_birth_order3/>5 -0.01649 0.01495 -1.103 10071 0.2701 -0.04579 0.01281
fixed NA count_birth_order4/>5 -0.005982 0.01468 -0.4074 10070 0.6837 -0.03476 0.0228
fixed NA count_birth_order5/>5 -0.007781 0.01485 -0.524 10071 0.6003 -0.03688 0.02132
fixed NA count_birth_order>5/>5 -0.005229 0.01203 -0.4346 9195 0.6638 -0.02881 0.01835
ran_pars mother_pidlink sd__(Intercept) 0.09533 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2537 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 2203 2282 -1090 2181 NA NA NA
12 2205 2291 -1090 2181 0.01918 1 0.8899
16 2213 2328 -1090 2181 0.1667 4 0.9967
26 2218 2406 -1083 2166 14.27 10 0.1609

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5278 0.1723 3.064 3822 0.002199 0.1902 0.8654
fixed NA poly(age, 3, raw = TRUE)1 -0.04411 0.0185 -2.385 3822 0.01715 -0.08037 -0.007856
fixed NA poly(age, 3, raw = TRUE)2 0.00134 0.0006347 2.111 3822 0.03487 0.00009561 0.002583
fixed NA poly(age, 3, raw = TRUE)3 -0.00001395 0.000006968 -2.001 3822 0.04541 -0.0000276 -0.0000002891
fixed NA male 0.04766 0.008681 5.49 3804 0.00000004281 0.03064 0.06467
fixed NA sibling_count3 -0.005651 0.01432 -0.3946 3064 0.6932 -0.03372 0.02242
fixed NA sibling_count4 0.009222 0.0148 0.6229 2846 0.5334 -0.01979 0.03824
fixed NA sibling_count5 -0.01576 0.01645 -0.9578 2523 0.3383 -0.04801 0.01649
fixed NA sibling_count>5 0.02188 0.01429 1.531 2492 0.1258 -0.006124 0.04988
ran_pars mother_pidlink sd__(Intercept) 0.08695 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2512 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5268 0.1723 3.058 3821 0.002247 0.1891 0.8645
fixed NA birth_order -0.00116 0.002699 -0.4297 3683 0.6675 -0.006449 0.00413
fixed NA poly(age, 3, raw = TRUE)1 -0.04386 0.01851 -2.37 3821 0.01785 -0.08014 -0.007585
fixed NA poly(age, 3, raw = TRUE)2 0.001333 0.0006349 2.1 3821 0.03576 0.00008914 0.002578
fixed NA poly(age, 3, raw = TRUE)3 -0.00001393 0.000006969 -1.999 3821 0.04569 -0.00002759 -0.0000002715
fixed NA male 0.04769 0.008682 5.493 3802 0.00000004207 0.03067 0.06471
fixed NA sibling_count3 -0.005053 0.01439 -0.3512 3064 0.7255 -0.03326 0.02315
fixed NA sibling_count4 0.01051 0.01511 0.6959 2846 0.4865 -0.0191 0.04012
fixed NA sibling_count5 -0.01363 0.01718 -0.7934 2567 0.4276 -0.04731 0.02005
fixed NA sibling_count>5 0.02605 0.01727 1.508 2653 0.1316 -0.007805 0.05991
ran_pars mother_pidlink sd__(Intercept) 0.08704 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2512 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5254 0.1725 3.046 3817 0.002338 0.1873 0.8635
fixed NA poly(age, 3, raw = TRUE)1 -0.0439 0.01852 -2.37 3817 0.01782 -0.0802 -0.007599
fixed NA poly(age, 3, raw = TRUE)2 0.001338 0.0006353 2.106 3817 0.03531 0.00009249 0.002583
fixed NA poly(age, 3, raw = TRUE)3 -0.00001404 0.000006975 -2.013 3817 0.04416 -0.00002771 -0.0000003718
fixed NA male 0.04763 0.008685 5.484 3798 0.00000004422 0.03061 0.06465
fixed NA sibling_count3 -0.001229 0.01468 -0.08376 3161 0.9333 -0.03 0.02754
fixed NA sibling_count4 0.01619 0.01565 1.035 3031 0.3009 -0.01448 0.04687
fixed NA sibling_count5 -0.00553 0.01801 -0.3071 2835 0.7588 -0.04082 0.02976
fixed NA sibling_count>5 0.03521 0.01774 1.985 2798 0.04725 0.0004435 0.06997
fixed NA birth_order_nonlinear2 0.0003386 0.01147 0.02952 3348 0.9764 -0.02214 0.02282
fixed NA birth_order_nonlinear3 -0.01783 0.01349 -1.322 3441 0.1864 -0.04427 0.008611
fixed NA birth_order_nonlinear4 -0.01307 0.01643 -0.7954 3512 0.4264 -0.04528 0.01914
fixed NA birth_order_nonlinear5 -0.01722 0.02021 -0.8518 3529 0.3944 -0.05683 0.02239
fixed NA birth_order_nonlinear>5 -0.01704 0.02005 -0.8501 3809 0.3953 -0.05634 0.02225
ran_pars mother_pidlink sd__(Intercept) 0.08715 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2512 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5537 0.1731 3.199 3807 0.00139 0.2145 0.8929
fixed NA poly(age, 3, raw = TRUE)1 -0.04629 0.01858 -2.491 3807 0.01279 -0.08271 -0.009864
fixed NA poly(age, 3, raw = TRUE)2 0.001425 0.0006377 2.234 3807 0.02552 0.000175 0.002675
fixed NA poly(age, 3, raw = TRUE)3 -0.00001505 0.000007003 -2.15 3807 0.03163 -0.00002878 -0.00000133
fixed NA male 0.04776 0.008695 5.492 3788 0.00000004224 0.03071 0.0648
fixed NA count_birth_order2/2 -0.02316 0.02227 -1.04 3430 0.2985 -0.06681 0.02049
fixed NA count_birth_order1/3 -0.01659 0.01882 -0.8817 3797 0.378 -0.05348 0.02029
fixed NA count_birth_order2/3 0.002044 0.02091 0.09778 3806 0.9221 -0.03893 0.04302
fixed NA count_birth_order3/3 -0.0255 0.02262 -1.127 3807 0.2596 -0.06982 0.01883
fixed NA count_birth_order1/4 -0.0171 0.02162 -0.7912 3804 0.4289 -0.05947 0.02527
fixed NA count_birth_order2/4 0.01951 0.02274 0.858 3807 0.391 -0.02506 0.06407
fixed NA count_birth_order3/4 0.004401 0.02385 0.1845 3805 0.8536 -0.04235 0.05115
fixed NA count_birth_order4/4 0.006849 0.0253 0.2707 3803 0.7866 -0.04274 0.05644
fixed NA count_birth_order1/5 -0.0173 0.02837 -0.6099 3807 0.5419 -0.0729 0.0383
fixed NA count_birth_order2/5 -0.008308 0.03089 -0.269 3797 0.7879 -0.06884 0.05223
fixed NA count_birth_order3/5 -0.03295 0.02893 -1.139 3799 0.2549 -0.08966 0.02376
fixed NA count_birth_order4/5 -0.03155 0.02815 -1.121 3798 0.2624 -0.08671 0.02362
fixed NA count_birth_order5/5 -0.02164 0.02952 -0.7332 3794 0.4635 -0.07949 0.03621
fixed NA count_birth_order1/>5 0.07584 0.02698 2.811 3807 0.00496 0.02297 0.1287
fixed NA count_birth_order2/>5 0.01185 0.02723 0.4352 3801 0.6634 -0.04152 0.06523
fixed NA count_birth_order3/>5 -0.007979 0.02663 -0.2996 3796 0.7645 -0.06017 0.04421
fixed NA count_birth_order4/>5 0.007473 0.02587 0.2889 3790 0.7727 -0.04322 0.05817
fixed NA count_birth_order5/>5 0.004793 0.02494 0.1922 3793 0.8476 -0.04409 0.05368
fixed NA count_birth_order>5/>5 0.01042 0.01941 0.5368 3614 0.5915 -0.02762 0.04846
ran_pars mother_pidlink sd__(Intercept) 0.08705 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2512 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 715.1 783.9 -346.6 693.1 NA NA NA
12 716.9 791.9 -346.5 692.9 0.1845 1 0.6675
16 722.4 822.4 -345.2 690.4 2.501 4 0.6444
26 731 893.5 -339.5 679 11.45 10 0.3232

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5216 0.1714 3.044 3848 0.00235 0.1858 0.8575
fixed NA poly(age, 3, raw = TRUE)1 -0.04348 0.01842 -2.36 3848 0.01831 -0.07958 -0.007375
fixed NA poly(age, 3, raw = TRUE)2 0.001321 0.0006321 2.09 3848 0.03669 0.00008216 0.00256
fixed NA poly(age, 3, raw = TRUE)3 -0.00001375 0.000006941 -1.98 3848 0.04774 -0.00002735 -0.0000001409
fixed NA male 0.04835 0.008643 5.595 3829 0.00000002367 0.03141 0.0653
fixed NA sibling_count3 -0.01324 0.01568 -0.8443 3150 0.3986 -0.04397 0.01749
fixed NA sibling_count4 -0.005395 0.01581 -0.3412 3004 0.7329 -0.03638 0.02559
fixed NA sibling_count5 0.008151 0.01666 0.4892 2775 0.6247 -0.02451 0.04081
fixed NA sibling_count>5 0.01342 0.01461 0.9192 2856 0.3581 -0.0152 0.04205
ran_pars mother_pidlink sd__(Intercept) 0.08703 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2509 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5211 0.1714 3.041 3847 0.002376 0.1852 0.857
fixed NA birth_order -0.0006892 0.002377 -0.2899 3595 0.7719 -0.005349 0.00397
fixed NA poly(age, 3, raw = TRUE)1 -0.04334 0.01843 -2.352 3847 0.01873 -0.07946 -0.007223
fixed NA poly(age, 3, raw = TRUE)2 0.001318 0.0006322 2.084 3847 0.03719 0.00007869 0.002557
fixed NA poly(age, 3, raw = TRUE)3 -0.00001374 0.000006942 -1.979 3847 0.04784 -0.00002735 -0.0000001349
fixed NA male 0.04837 0.008644 5.596 3828 0.00000002354 0.03143 0.06531
fixed NA sibling_count3 -0.01288 0.01573 -0.8184 3146 0.4132 -0.04371 0.01796
fixed NA sibling_count4 -0.004677 0.016 -0.2923 2994 0.7701 -0.03605 0.02669
fixed NA sibling_count5 0.00933 0.01715 0.544 2782 0.5865 -0.02429 0.04295
fixed NA sibling_count>5 0.01586 0.01685 0.9413 2895 0.3466 -0.01716 0.04888
ran_pars mother_pidlink sd__(Intercept) 0.0871 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2509 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5174 0.1715 3.017 3843 0.002572 0.1813 0.8536
fixed NA poly(age, 3, raw = TRUE)1 -0.04304 0.01843 -2.335 3843 0.01959 -0.07916 -0.006915
fixed NA poly(age, 3, raw = TRUE)2 0.001309 0.0006324 2.069 3843 0.0386 0.00006903 0.002548
fixed NA poly(age, 3, raw = TRUE)3 -0.0000137 0.000006945 -1.973 3843 0.04859 -0.00002731 -0.00000008901
fixed NA male 0.04827 0.008643 5.585 3823 0.000000025 0.03133 0.06521
fixed NA sibling_count3 -0.008033 0.01601 -0.5018 3218 0.6158 -0.03941 0.02334
fixed NA sibling_count4 0.004259 0.01648 0.2584 3129 0.7961 -0.02804 0.03656
fixed NA sibling_count5 0.01848 0.01791 1.032 2998 0.3021 -0.01662 0.05357
fixed NA sibling_count>5 0.02776 0.01734 1.602 3038 0.1094 -0.006214 0.06174
fixed NA birth_order_nonlinear2 0.001952 0.0116 0.1683 3403 0.8663 -0.02078 0.02469
fixed NA birth_order_nonlinear3 -0.02108 0.01354 -1.558 3505 0.1194 -0.04761 0.005446
fixed NA birth_order_nonlinear4 -0.0265 0.01601 -1.655 3578 0.09792 -0.05787 0.004873
fixed NA birth_order_nonlinear5 -0.002944 0.0195 -0.151 3594 0.88 -0.04116 0.03527
fixed NA birth_order_nonlinear>5 -0.01788 0.01808 -0.989 3809 0.3227 -0.05332 0.01756
ran_pars mother_pidlink sd__(Intercept) 0.08779 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2506 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5206 0.1719 3.028 3833 0.002478 0.1836 0.8575
fixed NA poly(age, 3, raw = TRUE)1 -0.04292 0.01848 -2.323 3833 0.02023 -0.07913 -0.006707
fixed NA poly(age, 3, raw = TRUE)2 0.00131 0.0006341 2.066 3833 0.03888 0.00006733 0.002553
fixed NA poly(age, 3, raw = TRUE)3 -0.00001377 0.000006966 -1.977 3833 0.04816 -0.00002742 -0.000000116
fixed NA male 0.04851 0.008658 5.603 3814 0.00000002261 0.03154 0.06548
fixed NA count_birth_order2/2 -0.0166 0.02448 -0.6779 3541 0.4979 -0.06458 0.03138
fixed NA count_birth_order1/3 -0.02012 0.02077 -0.9688 3824 0.3327 -0.06082 0.02058
fixed NA count_birth_order2/3 -0.003152 0.0226 -0.1394 3831 0.8891 -0.04745 0.04115
fixed NA count_birth_order3/3 -0.03641 0.02486 -1.465 3833 0.1431 -0.08513 0.01231
fixed NA count_birth_order1/4 -0.02499 0.02258 -1.107 3828 0.2685 -0.06926 0.01927
fixed NA count_birth_order2/4 0.008599 0.02357 0.3648 3833 0.7153 -0.03761 0.0548
fixed NA count_birth_order3/4 -0.01663 0.02578 -0.6451 3831 0.5189 -0.06717 0.0339
fixed NA count_birth_order4/4 -0.006556 0.02753 -0.2381 3829 0.8118 -0.06052 0.0474
fixed NA count_birth_order1/5 0.01083 0.02708 0.3998 3833 0.6893 -0.04225 0.06391
fixed NA count_birth_order2/5 0.01599 0.02815 0.5683 3832 0.5699 -0.03917 0.07116
fixed NA count_birth_order3/5 0.01195 0.02866 0.417 3828 0.6767 -0.04422 0.06812
fixed NA count_birth_order4/5 -0.01794 0.02915 -0.6154 3823 0.5383 -0.07506 0.03919
fixed NA count_birth_order5/5 -0.01009 0.02936 -0.3437 3822 0.7311 -0.06764 0.04745
fixed NA count_birth_order1/>5 0.04959 0.02449 2.025 3831 0.04292 0.001597 0.09759
fixed NA count_birth_order2/>5 0.01055 0.0259 0.4072 3830 0.6838 -0.04022 0.06132
fixed NA count_birth_order3/>5 -0.01746 0.02495 -0.6998 3829 0.4841 -0.06636 0.03144
fixed NA count_birth_order4/>5 -0.01776 0.02434 -0.7295 3826 0.4657 -0.06546 0.02995
fixed NA count_birth_order5/>5 0.03147 0.02575 1.222 3817 0.2217 -0.019 0.08195
fixed NA count_birth_order>5/>5 0.00355 0.01941 0.1829 3667 0.8549 -0.03448 0.04158
ran_pars mother_pidlink sd__(Intercept) 0.08629 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2511 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 711.8 780.7 -344.9 689.8 NA NA NA
12 713.7 788.8 -344.9 689.7 0.08395 1 0.772
16 716.2 816.4 -342.1 684.2 5.493 4 0.2404
26 726.6 889.3 -337.3 674.6 9.669 10 0.47

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5159 0.1741 2.964 3754 0.003058 0.1747 0.857
fixed NA poly(age, 3, raw = TRUE)1 -0.04311 0.01872 -2.303 3754 0.02134 -0.07981 -0.006419
fixed NA poly(age, 3, raw = TRUE)2 0.001318 0.0006429 2.05 3754 0.04042 0.000058 0.002578
fixed NA poly(age, 3, raw = TRUE)3 -0.00001381 0.000007066 -1.955 3754 0.05066 -0.00002766 0.00000003501
fixed NA male 0.04962 0.008764 5.662 3736 0.00000001612 0.03244 0.0668
fixed NA sibling_count3 -0.007423 0.01403 -0.5289 3020 0.5969 -0.03493 0.02008
fixed NA sibling_count4 0.003436 0.01471 0.2335 2796 0.8154 -0.0254 0.03227
fixed NA sibling_count5 -0.02066 0.01679 -1.23 2393 0.2187 -0.05357 0.01225
fixed NA sibling_count>5 0.02131 0.01435 1.485 2381 0.1376 -0.006809 0.04943
ran_pars mother_pidlink sd__(Intercept) 0.08655 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2514 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5148 0.1741 2.956 3753 0.003131 0.1735 0.856
fixed NA birth_order -0.0009926 0.002778 -0.3573 3637 0.7209 -0.006437 0.004452
fixed NA poly(age, 3, raw = TRUE)1 -0.04287 0.01874 -2.288 3753 0.02219 -0.07959 -0.006147
fixed NA poly(age, 3, raw = TRUE)2 0.001312 0.0006432 2.04 3753 0.04146 0.00005121 0.002572
fixed NA poly(age, 3, raw = TRUE)3 -0.00001379 0.000007067 -1.951 3753 0.05111 -0.00002764 0.00000006217
fixed NA male 0.04963 0.008765 5.662 3735 0.00000001612 0.03245 0.0668
fixed NA sibling_count3 -0.006901 0.01411 -0.4891 3018 0.6248 -0.03456 0.02076
fixed NA sibling_count4 0.004525 0.01502 0.3012 2801 0.7633 -0.02492 0.03397
fixed NA sibling_count5 -0.01889 0.01751 -1.079 2434 0.2806 -0.0532 0.01542
fixed NA sibling_count>5 0.02488 0.01747 1.424 2596 0.1547 -0.009374 0.05913
ran_pars mother_pidlink sd__(Intercept) 0.08661 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2514 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5132 0.1743 2.944 3749 0.003264 0.1715 0.8548
fixed NA poly(age, 3, raw = TRUE)1 -0.04284 0.01875 -2.285 3749 0.02236 -0.07958 -0.006096
fixed NA poly(age, 3, raw = TRUE)2 0.001315 0.0006437 2.044 3749 0.04106 0.00005383 0.002577
fixed NA poly(age, 3, raw = TRUE)3 -0.00001392 0.000007074 -1.968 3749 0.04918 -0.00002778 -0.0000000542
fixed NA male 0.04953 0.00877 5.648 3731 0.00000001749 0.03234 0.06672
fixed NA sibling_count3 -0.004327 0.01441 -0.3003 3115 0.764 -0.03257 0.02392
fixed NA sibling_count4 0.009017 0.01557 0.5791 2982 0.5626 -0.0215 0.03954
fixed NA sibling_count5 -0.01119 0.01828 -0.6119 2684 0.5407 -0.04702 0.02465
fixed NA sibling_count>5 0.0347 0.01797 1.931 2747 0.0536 -0.0005219 0.06991
fixed NA birth_order_nonlinear2 -0.001036 0.01143 -0.09066 3280 0.9278 -0.02344 0.02136
fixed NA birth_order_nonlinear3 -0.01195 0.01352 -0.8841 3375 0.3767 -0.03845 0.01454
fixed NA birth_order_nonlinear4 -0.01326 0.01694 -0.7827 3451 0.4339 -0.04646 0.01994
fixed NA birth_order_nonlinear5 -0.02167 0.02087 -1.038 3436 0.2992 -0.06258 0.01924
fixed NA birth_order_nonlinear>5 -0.01784 0.02069 -0.8624 3743 0.3885 -0.05839 0.02271
ran_pars mother_pidlink sd__(Intercept) 0.08642 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2516 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5353 0.1748 3.062 3739 0.002214 0.1927 0.8779
fixed NA poly(age, 3, raw = TRUE)1 -0.04495 0.0188 -2.391 3739 0.01685 -0.0818 -0.008104
fixed NA poly(age, 3, raw = TRUE)2 0.001394 0.0006457 2.158 3739 0.03097 0.0001281 0.002659
fixed NA poly(age, 3, raw = TRUE)3 -0.00001485 0.000007099 -2.092 3739 0.03653 -0.00002876 -0.0000009356
fixed NA male 0.04938 0.00878 5.625 3720 0.00000001994 0.03218 0.06659
fixed NA count_birth_order2/2 -0.0126 0.02165 -0.5819 3342 0.5607 -0.05504 0.02984
fixed NA count_birth_order1/3 -0.0158 0.01851 -0.8535 3730 0.3934 -0.05207 0.02048
fixed NA count_birth_order2/3 0.0005413 0.02059 0.02629 3739 0.979 -0.03981 0.04089
fixed NA count_birth_order3/3 -0.01806 0.02204 -0.8195 3738 0.4125 -0.06126 0.02514
fixed NA count_birth_order1/4 -0.01388 0.02171 -0.6392 3736 0.5227 -0.05642 0.02867
fixed NA count_birth_order2/4 0.01046 0.02269 0.461 3739 0.6448 -0.03401 0.05493
fixed NA count_birth_order3/4 0.00654 0.02379 0.275 3736 0.7834 -0.04008 0.05316
fixed NA count_birth_order4/4 -0.001575 0.02566 -0.06138 3734 0.9511 -0.05186 0.04871
fixed NA count_birth_order1/5 -0.02303 0.0284 -0.811 3739 0.4174 -0.07869 0.03263
fixed NA count_birth_order2/5 0.007691 0.03189 0.2412 3726 0.8094 -0.0548 0.07019
fixed NA count_birth_order3/5 -0.03383 0.03054 -1.108 3727 0.2681 -0.09369 0.02603
fixed NA count_birth_order4/5 -0.04271 0.02946 -1.45 3728 0.1471 -0.1004 0.01502
fixed NA count_birth_order5/5 -0.02514 0.03101 -0.8108 3725 0.4176 -0.08592 0.03564
fixed NA count_birth_order1/>5 0.08574 0.02768 3.098 3739 0.001963 0.0315 0.14
fixed NA count_birth_order2/>5 -0.0053 0.02803 -0.189 3732 0.8501 -0.06025 0.04965
fixed NA count_birth_order3/>5 0.003049 0.02684 0.1136 3730 0.9096 -0.04956 0.05566
fixed NA count_birth_order4/>5 0.02215 0.02671 0.8294 3719 0.407 -0.0302 0.0745
fixed NA count_birth_order5/>5 0.00261 0.02527 0.1033 3724 0.9178 -0.04692 0.05214
fixed NA count_birth_order>5/>5 0.01287 0.01968 0.6538 3521 0.5133 -0.0257 0.05144
ran_pars mother_pidlink sd__(Intercept) 0.08667 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2514 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 705.5 774 -341.7 683.5 NA NA NA
12 707.4 782.2 -341.7 683.4 0.1277 1 0.7209
16 713.6 813.3 -340.8 681.6 1.778 4 0.7765
26 721 883.1 -334.5 669 12.58 10 0.2478

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Category_Government worker

birthorder <- birthorder %>% mutate(outcome = `Category_Government worker`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1944 0.05324 -3.651 10007 0.0002623 -0.2987 -0.09004
fixed NA poly(age, 3, raw = TRUE)1 0.01928 0.004779 4.034 9983 0.00005525 0.009912 0.02865
fixed NA poly(age, 3, raw = TRUE)2 -0.0004177 0.0001344 -3.108 9909 0.001891 -0.0006812 -0.0001543
fixed NA poly(age, 3, raw = TRUE)3 0.000002971 0.000001196 2.484 9809 0.013 0.0000006272 0.000005316
fixed NA male -0.02151 0.004853 -4.432 9733 0.000009455 -0.03102 -0.012
fixed NA sibling_count3 0.008502 0.01049 0.8108 7091 0.4175 -0.01205 0.02905
fixed NA sibling_count4 0.01057 0.0106 0.9964 6790 0.3191 -0.01022 0.03135
fixed NA sibling_count5 0.01661 0.01108 1.498 6417 0.1341 -0.005117 0.03833
fixed NA sibling_count>5 -0.009424 0.008552 -1.102 7030 0.2705 -0.02619 0.007337
ran_pars mother_pidlink sd__(Intercept) 0.1135 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2183 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1943 0.05324 -3.649 10004 0.0002645 -0.2986 -0.08993
fixed NA birth_order -0.0002719 0.001006 -0.2703 9789 0.787 -0.002244 0.0017
fixed NA poly(age, 3, raw = TRUE)1 0.01936 0.004788 4.043 9976 0.00005323 0.009972 0.02874
fixed NA poly(age, 3, raw = TRUE)2 -0.0004207 0.0001349 -3.119 9878 0.001818 -0.000685 -0.0001563
fixed NA poly(age, 3, raw = TRUE)3 0.000002999 0.0000012 2.498 9760 0.0125 0.000000646 0.000005352
fixed NA male -0.02151 0.004854 -4.431 9732 0.000009492 -0.03102 -0.01199
fixed NA sibling_count3 0.008566 0.01049 0.8168 7098 0.4141 -0.01199 0.02912
fixed NA sibling_count4 0.01072 0.01062 1.009 6834 0.3128 -0.01009 0.03153
fixed NA sibling_count5 0.01689 0.01113 1.517 6506 0.1293 -0.004931 0.0387
fixed NA sibling_count>5 -0.008494 0.00922 -0.9212 7868 0.357 -0.02656 0.009577
ran_pars mother_pidlink sd__(Intercept) 0.1135 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2183 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1934 0.0533 -3.628 10005 0.0002868 -0.2979 -0.08892
fixed NA poly(age, 3, raw = TRUE)1 0.01971 0.004791 4.115 9976 0.00003905 0.01032 0.0291
fixed NA poly(age, 3, raw = TRUE)2 -0.0004282 0.0001349 -3.175 9880 0.001505 -0.0006926 -0.0001639
fixed NA poly(age, 3, raw = TRUE)3 0.000003015 0.000001201 2.511 9759 0.01205 0.0000006618 0.000005368
fixed NA male -0.02147 0.004854 -4.424 9730 0.000009815 -0.03098 -0.01196
fixed NA sibling_count3 0.01191 0.01062 1.121 7339 0.2621 -0.008906 0.03273
fixed NA sibling_count4 0.01411 0.01086 1.299 7266 0.194 -0.007181 0.03541
fixed NA sibling_count5 0.02163 0.01146 1.888 7047 0.05907 -0.0008248 0.04409
fixed NA sibling_count>5 -0.002547 0.009608 -0.2651 8468 0.7909 -0.02138 0.01628
fixed NA birth_order_nonlinear2 -0.01229 0.007011 -1.753 9053 0.07964 -0.02603 0.001451
fixed NA birth_order_nonlinear3 -0.01874 0.008133 -2.304 8783 0.02124 -0.03468 -0.002798
fixed NA birth_order_nonlinear4 -0.00766 0.009138 -0.8382 8836 0.4019 -0.02557 0.01025
fixed NA birth_order_nonlinear5 -0.01681 0.01028 -1.634 8828 0.1022 -0.03696 0.003347
fixed NA birth_order_nonlinear>5 -0.0144 0.008664 -1.662 10000 0.09648 -0.03138 0.002579
ran_pars mother_pidlink sd__(Intercept) 0.1133 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2184 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1926 0.05348 -3.602 10001 0.000317 -0.2975 -0.08783
fixed NA poly(age, 3, raw = TRUE)1 0.0199 0.004794 4.151 9966 0.00003341 0.0105 0.0293
fixed NA poly(age, 3, raw = TRUE)2 -0.0004295 0.000135 -3.182 9868 0.001467 -0.000694 -0.000165
fixed NA poly(age, 3, raw = TRUE)3 0.000002987 0.000001201 2.486 9744 0.01292 0.0000006324 0.000005341
fixed NA male -0.02117 0.004856 -4.36 9719 0.00001315 -0.03069 -0.01165
fixed NA count_birth_order2/2 -0.0235 0.01393 -1.687 9168 0.09155 -0.0508 0.003795
fixed NA count_birth_order1/3 0.02031 0.01377 1.475 9837 0.1403 -0.00668 0.04729
fixed NA count_birth_order2/3 -0.01708 0.01523 -1.121 9957 0.2623 -0.04693 0.01278
fixed NA count_birth_order3/3 -0.01838 0.0167 -1.101 10031 0.2711 -0.05112 0.01435
fixed NA count_birth_order1/4 0.009319 0.01506 0.6189 9952 0.536 -0.02019 0.03883
fixed NA count_birth_order2/4 0.01105 0.01613 0.685 10007 0.4934 -0.02056 0.04265
fixed NA count_birth_order3/4 -0.0106 0.01717 -0.6175 10050 0.5369 -0.04426 0.02305
fixed NA count_birth_order4/4 -0.01459 0.01822 -0.8008 10065 0.4233 -0.05031 0.02113
fixed NA count_birth_order1/5 0.01084 0.01706 0.6352 10034 0.5253 -0.0226 0.04428
fixed NA count_birth_order2/5 -0.002587 0.01808 -0.1431 10054 0.8862 -0.03802 0.03285
fixed NA count_birth_order3/5 0.01388 0.01901 0.7301 10069 0.4653 -0.02338 0.05115
fixed NA count_birth_order4/5 0.006791 0.01995 0.3404 10060 0.7335 -0.03231 0.04589
fixed NA count_birth_order5/5 0.006184 0.01996 0.3098 10070 0.7567 -0.03294 0.04531
fixed NA count_birth_order1/>5 -0.01924 0.01312 -1.466 10065 0.1427 -0.04496 0.006483
fixed NA count_birth_order2/>5 -0.01011 0.01365 -0.7407 10071 0.4589 -0.03687 0.01664
fixed NA count_birth_order3/>5 -0.027 0.01345 -2.008 10071 0.0447 -0.05336 -0.0006427
fixed NA count_birth_order4/>5 -0.007687 0.01322 -0.5815 10068 0.5609 -0.0336 0.01822
fixed NA count_birth_order5/>5 -0.02553 0.01336 -1.911 10071 0.05601 -0.05171 0.000652
fixed NA count_birth_order>5/>5 -0.02128 0.01098 -1.938 9079 0.0526 -0.0428 0.0002367
ran_pars mother_pidlink sd__(Intercept) 0.1134 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2183 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 72.34 151.8 -25.17 50.34 NA NA NA
12 74.27 160.9 -25.13 50.27 0.0738 1 0.7859
16 75.28 190.8 -21.64 43.28 6.987 4 0.1366
26 84.51 272.2 -16.26 32.51 10.77 10 0.3758

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.867 0.1698 -5.107 3812 0.0000003439 -1.2 -0.5343
fixed NA poly(age, 3, raw = TRUE)1 0.09225 0.01822 5.062 3805 0.0000004346 0.05653 0.128
fixed NA poly(age, 3, raw = TRUE)2 -0.002883 0.000625 -4.613 3799 0.000004102 -0.004108 -0.001658
fixed NA poly(age, 3, raw = TRUE)3 0.00003017 0.000006861 4.397 3796 0.00001128 0.00001672 0.00004362
fixed NA male -0.02578 0.008528 -3.023 3756 0.002518 -0.0425 -0.009067
fixed NA sibling_count3 0.007785 0.01443 0.5395 3139 0.5896 -0.0205 0.03607
fixed NA sibling_count4 0.004312 0.01497 0.2881 2988 0.7733 -0.02502 0.03365
fixed NA sibling_count5 0.003921 0.01672 0.2346 2759 0.8146 -0.02884 0.03668
fixed NA sibling_count>5 -0.0358 0.01452 -2.465 2751 0.01375 -0.06425 -0.007338
ran_pars mother_pidlink sd__(Intercept) 0.1191 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2355 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.871 0.1698 -5.13 3812 0.0000003048 -1.204 -0.5382
fixed NA birth_order -0.003387 0.002677 -1.265 3806 0.2059 -0.008633 0.00186
fixed NA poly(age, 3, raw = TRUE)1 0.09312 0.01824 5.106 3807 0.0000003445 0.05738 0.1289
fixed NA poly(age, 3, raw = TRUE)2 -0.002906 0.0006253 -4.648 3801 0.000003473 -0.004131 -0.00168
fixed NA poly(age, 3, raw = TRUE)3 0.00003026 0.000006861 4.411 3796 0.0000106 0.00001681 0.00004371
fixed NA male -0.02566 0.008528 -3.009 3755 0.002635 -0.04238 -0.00895
fixed NA sibling_count3 0.009541 0.01449 0.6583 3140 0.5104 -0.01887 0.03795
fixed NA sibling_count4 0.008137 0.01526 0.5331 2993 0.594 -0.02178 0.03805
fixed NA sibling_count5 0.0102 0.01743 0.5852 2808 0.5585 -0.02396 0.04436
fixed NA sibling_count>5 -0.02346 0.01749 -1.341 2930 0.1799 -0.05774 0.01082
ran_pars mother_pidlink sd__(Intercept) 0.1187 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2356 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8585 0.17 -5.05 3808 0.0000004629 -1.192 -0.5253
fixed NA poly(age, 3, raw = TRUE)1 0.09185 0.01824 5.034 3801 0.0000005013 0.05609 0.1276
fixed NA poly(age, 3, raw = TRUE)2 -0.002859 0.0006256 -4.571 3795 0.000005014 -0.004086 -0.001633
fixed NA poly(age, 3, raw = TRUE)3 0.00002975 0.000006867 4.332 3790 0.00001513 0.00001629 0.00004321
fixed NA male -0.02605 0.00853 -3.054 3750 0.002274 -0.04277 -0.009332
fixed NA sibling_count3 0.01138 0.01476 0.7712 3220 0.4407 -0.01755 0.04031
fixed NA sibling_count4 0.007978 0.01577 0.506 3141 0.6129 -0.02293 0.03888
fixed NA sibling_count5 0.01 0.01819 0.5499 3023 0.5824 -0.02565 0.04566
fixed NA sibling_count>5 -0.02489 0.01792 -1.389 3040 0.165 -0.06001 0.01024
fixed NA birth_order_nonlinear2 -0.01938 0.01113 -1.741 3347 0.08182 -0.04121 0.002441
fixed NA birth_order_nonlinear3 -0.01584 0.01312 -1.207 3408 0.2273 -0.04154 0.009869
fixed NA birth_order_nonlinear4 -0.004245 0.016 -0.2654 3457 0.7908 -0.0356 0.02711
fixed NA birth_order_nonlinear5 -0.02336 0.01968 -1.187 3456 0.2353 -0.06192 0.01521
fixed NA birth_order_nonlinear>5 -0.02327 0.01977 -1.177 3805 0.2392 -0.06203 0.01548
ran_pars mother_pidlink sd__(Intercept) 0.1191 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2355 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.837 0.1707 -4.905 3798 0.0000009749 -1.172 -0.5026
fixed NA poly(age, 3, raw = TRUE)1 0.08981 0.01832 4.903 3792 0.0000009818 0.05391 0.1257
fixed NA poly(age, 3, raw = TRUE)2 -0.00279 0.0006283 -4.441 3787 0.000009204 -0.004022 -0.001559
fixed NA poly(age, 3, raw = TRUE)3 0.00002901 0.000006898 4.205 3783 0.00002671 0.00001549 0.00004253
fixed NA male -0.02647 0.008544 -3.098 3740 0.001965 -0.04321 -0.00972
fixed NA count_birth_order2/2 -0.02663 0.02168 -1.228 3480 0.2194 -0.06913 0.01586
fixed NA count_birth_order1/3 0.0166 0.01863 0.8912 3784 0.3729 -0.01991 0.05311
fixed NA count_birth_order2/3 -0.01654 0.02066 -0.8007 3804 0.4234 -0.05702 0.02395
fixed NA count_birth_order3/3 -0.01347 0.02232 -0.6033 3807 0.5463 -0.05721 0.03028
fixed NA count_birth_order1/4 -0.01372 0.02137 -0.6419 3801 0.521 -0.0556 0.02817
fixed NA count_birth_order2/4 0.01028 0.02244 0.4582 3807 0.6468 -0.0337 0.05427
fixed NA count_birth_order3/4 0.003243 0.02351 0.1379 3802 0.8903 -0.04284 0.04932
fixed NA count_birth_order4/4 -0.01605 0.02493 -0.644 3798 0.5196 -0.06492 0.03281
fixed NA count_birth_order1/5 0.01175 0.02799 0.4196 3807 0.6748 -0.04312 0.06661
fixed NA count_birth_order2/5 -0.03345 0.03039 -1.101 3781 0.2711 -0.09303 0.02612
fixed NA count_birth_order3/5 -0.03181 0.02849 -1.116 3789 0.2643 -0.08764 0.02403
fixed NA count_birth_order4/5 0.02514 0.02771 0.9072 3788 0.3644 -0.02917 0.07944
fixed NA count_birth_order5/5 -0.000456 0.02904 -0.0157 3782 0.9875 -0.05738 0.05647
fixed NA count_birth_order1/>5 -0.02476 0.0266 -0.9311 3799 0.3519 -0.07689 0.02737
fixed NA count_birth_order2/>5 -0.04955 0.0268 -1.849 3778 0.0646 -0.1021 0.002986
fixed NA count_birth_order3/>5 -0.03274 0.0262 -1.25 3773 0.2114 -0.08409 0.0186
fixed NA count_birth_order4/>5 -0.03021 0.02543 -1.188 3764 0.2349 -0.08006 0.01963
fixed NA count_birth_order5/>5 -0.06004 0.02453 -2.447 3774 0.01444 -0.1081 -0.01195
fixed NA count_birth_order>5/>5 -0.05057 0.01932 -2.617 3698 0.008898 -0.08844 -0.0127
ran_pars mother_pidlink sd__(Intercept) 0.1189 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2356 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 613.9 682.6 -295.9 591.9 NA NA NA
12 614.3 689.3 -295.1 590.3 1.606 1 0.205
16 619.3 719.3 -293.7 587.3 2.942 4 0.5676
26 630.8 793.3 -289.4 578.8 8.559 10 0.5744

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8577 0.1687 -5.085 3839 0.0000003845 -1.188 -0.5271
fixed NA poly(age, 3, raw = TRUE)1 0.09078 0.01812 5.01 3832 0.0000005698 0.05527 0.1263
fixed NA poly(age, 3, raw = TRUE)2 -0.002845 0.0006216 -4.577 3827 0.000004868 -0.004064 -0.001627
fixed NA poly(age, 3, raw = TRUE)3 0.00002981 0.000006826 4.367 3824 0.0000129 0.00001643 0.00004319
fixed NA male -0.02579 0.008479 -3.041 3783 0.002372 -0.04241 -0.009168
fixed NA sibling_count3 0.01011 0.01575 0.6416 3214 0.5212 -0.02077 0.04098
fixed NA sibling_count4 0.02064 0.01592 1.297 3111 0.1948 -0.01055 0.05184
fixed NA sibling_count5 0.01602 0.01683 0.9516 2952 0.3414 -0.01697 0.049
fixed NA sibling_count>5 -0.01717 0.01473 -1.166 3024 0.2439 -0.04605 0.0117
ran_pars mother_pidlink sd__(Intercept) 0.1183 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2351 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8617 0.1686 -5.11 3838 0.0000003384 -1.192 -0.5311
fixed NA birth_order -0.004012 0.00236 -1.7 3785 0.08927 -0.008638 0.0006143
fixed NA poly(age, 3, raw = TRUE)1 0.09173 0.01813 5.061 3833 0.0000004377 0.0562 0.1273
fixed NA poly(age, 3, raw = TRUE)2 -0.002869 0.0006217 -4.615 3828 0.000004057 -0.004088 -0.001651
fixed NA poly(age, 3, raw = TRUE)3 0.00002989 0.000006824 4.379 3823 0.00001222 0.00001651 0.00004326
fixed NA male -0.02568 0.008478 -3.029 3783 0.002473 -0.04229 -0.00906
fixed NA sibling_count3 0.01227 0.0158 0.7764 3213 0.4376 -0.0187 0.04323
fixed NA sibling_count4 0.0249 0.01611 1.546 3106 0.1223 -0.00667 0.05646
fixed NA sibling_count5 0.02296 0.01731 1.327 2966 0.1848 -0.01097 0.05689
fixed NA sibling_count>5 -0.002852 0.01697 -0.168 3094 0.8666 -0.03611 0.03041
ran_pars mother_pidlink sd__(Intercept) 0.1179 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2352 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.844 0.1687 -5.003 3834 0.0000005912 -1.175 -0.5133
fixed NA poly(age, 3, raw = TRUE)1 0.08976 0.01812 4.953 3828 0.0000007618 0.05424 0.1253
fixed NA poly(age, 3, raw = TRUE)2 -0.0028 0.0006216 -4.503 3823 0.000006884 -0.004018 -0.001581
fixed NA poly(age, 3, raw = TRUE)3 0.00002914 0.000006826 4.268 3819 0.00002016 0.00001576 0.00004251
fixed NA male -0.02612 0.008475 -3.082 3777 0.002072 -0.04273 -0.009508
fixed NA sibling_count3 0.01501 0.01605 0.9355 3276 0.3496 -0.01644 0.04646
fixed NA sibling_count4 0.02489 0.01654 1.505 3218 0.1324 -0.007523 0.05731
fixed NA sibling_count5 0.02825 0.018 1.569 3141 0.1167 -0.007033 0.06353
fixed NA sibling_count>5 -0.003534 0.01741 -0.203 3203 0.8392 -0.03766 0.03059
fixed NA birth_order_nonlinear2 -0.0175 0.01125 -1.555 3407 0.1201 -0.03955 0.004559
fixed NA birth_order_nonlinear3 -0.02054 0.01315 -1.561 3475 0.1186 -0.04632 0.005246
fixed NA birth_order_nonlinear4 -0.001737 0.01557 -0.1115 3528 0.9112 -0.03226 0.02879
fixed NA birth_order_nonlinear5 -0.05317 0.01898 -2.802 3531 0.005109 -0.09037 -0.01598
fixed NA birth_order_nonlinear>5 -0.02094 0.01784 -1.174 3843 0.2404 -0.0559 0.01402
ran_pars mother_pidlink sd__(Intercept) 0.1181 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.235 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8285 0.1689 -4.904 3825 0.0000009789 -1.16 -0.4974
fixed NA poly(age, 3, raw = TRUE)1 0.0882 0.01815 4.86 3819 0.000001221 0.05263 0.1238
fixed NA poly(age, 3, raw = TRUE)2 -0.002742 0.0006227 -4.404 3814 0.00001092 -0.003963 -0.001522
fixed NA poly(age, 3, raw = TRUE)3 0.00002847 0.000006839 4.163 3811 0.00003204 0.00001507 0.00004188
fixed NA male -0.0269 0.008477 -3.173 3766 0.001521 -0.04351 -0.01028
fixed NA count_birth_order2/2 -0.0224 0.0238 -0.9412 3591 0.3466 -0.06904 0.02424
fixed NA count_birth_order1/3 0.02072 0.02048 1.012 3810 0.3118 -0.01943 0.06087
fixed NA count_birth_order2/3 -0.01094 0.02226 -0.4914 3829 0.6232 -0.05457 0.03269
fixed NA count_birth_order3/3 -0.01167 0.02445 -0.4772 3833 0.6333 -0.05958 0.03625
fixed NA count_birth_order1/4 0.01157 0.02226 0.5198 3822 0.6032 -0.03206 0.0552
fixed NA count_birth_order2/4 0.0485 0.0232 2.09 3832 0.03664 0.003027 0.09397
fixed NA count_birth_order3/4 -0.008379 0.02533 -0.3308 3829 0.7408 -0.05803 0.04127
fixed NA count_birth_order4/4 -0.0125 0.02703 -0.4624 3824 0.6438 -0.06548 0.04048
fixed NA count_birth_order1/5 0.03036 0.02665 1.139 3833 0.2546 -0.02187 0.08259
fixed NA count_birth_order2/5 -0.02963 0.02765 -1.071 3829 0.2841 -0.08383 0.02457
fixed NA count_birth_order3/5 -0.007984 0.02813 -0.2838 3821 0.7766 -0.06312 0.04715
fixed NA count_birth_order4/5 0.07203 0.02859 2.52 3810 0.01179 0.016 0.1281
fixed NA count_birth_order5/5 -0.01908 0.0288 -0.6625 3811 0.5077 -0.07552 0.03736
fixed NA count_birth_order1/>5 -0.007641 0.0241 -0.317 3833 0.7512 -0.05488 0.0396
fixed NA count_birth_order2/>5 -0.03434 0.02542 -1.351 3816 0.1769 -0.08417 0.01549
fixed NA count_birth_order3/>5 -0.002912 0.02449 -0.1189 3819 0.9054 -0.05091 0.04509
fixed NA count_birth_order4/>5 -0.01136 0.02388 -0.4756 3816 0.6344 -0.05817 0.03545
fixed NA count_birth_order5/>5 -0.0629 0.02524 -2.492 3797 0.01274 -0.1124 -0.01343
fixed NA count_birth_order>5/>5 -0.02624 0.01925 -1.364 3727 0.1728 -0.06396 0.01148
ran_pars mother_pidlink sd__(Intercept) 0.1185 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2345 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 598.1 666.9 -288 576.1 NA NA NA
12 597.2 672.3 -286.6 573.2 2.897 1 0.08874
16 597.7 697.8 -282.8 565.7 7.516 4 0.111
26 599.1 761.8 -273.5 547.1 18.6 10 0.04565

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8904 0.1716 -5.188 3745 0.0000002242 -1.227 -0.554
fixed NA poly(age, 3, raw = TRUE)1 0.09498 0.01845 5.148 3738 0.0000002773 0.05882 0.1311
fixed NA poly(age, 3, raw = TRUE)2 -0.002992 0.0006334 -4.723 3733 0.000002406 -0.004233 -0.00175
fixed NA poly(age, 3, raw = TRUE)3 0.00003151 0.000006961 4.527 3729 0.000006182 0.00001787 0.00004515
fixed NA male -0.02612 0.008613 -3.032 3689 0.002444 -0.043 -0.009236
fixed NA sibling_count3 0.005929 0.01414 0.4193 3084 0.675 -0.02178 0.03364
fixed NA sibling_count4 0.01116 0.01487 0.7506 2923 0.453 -0.01799 0.04031
fixed NA sibling_count5 0.009306 0.01708 0.5449 2630 0.5858 -0.02417 0.04278
fixed NA sibling_count>5 -0.03426 0.01459 -2.347 2633 0.01898 -0.06286 -0.005654
ran_pars mother_pidlink sd__(Intercept) 0.1183 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.236 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8946 0.1717 -5.211 3745 0.0000001976 -1.231 -0.5582
fixed NA birth_order -0.003066 0.002754 -1.113 3744 0.2657 -0.008464 0.002332
fixed NA poly(age, 3, raw = TRUE)1 0.09584 0.01847 5.19 3740 0.0000002215 0.05965 0.132
fixed NA poly(age, 3, raw = TRUE)2 -0.003015 0.0006337 -4.757 3734 0.000002036 -0.004257 -0.001773
fixed NA poly(age, 3, raw = TRUE)3 0.00003162 0.000006962 4.543 3729 0.000005734 0.00001798 0.00004527
fixed NA male -0.02608 0.008613 -3.028 3688 0.002477 -0.04297 -0.009201
fixed NA sibling_count3 0.007558 0.01421 0.5318 3083 0.5949 -0.0203 0.03541
fixed NA sibling_count4 0.01457 0.01518 0.9599 2933 0.3372 -0.01518 0.04432
fixed NA sibling_count5 0.01484 0.01778 0.8345 2674 0.4041 -0.02001 0.04969
fixed NA sibling_count>5 -0.02312 0.0177 -1.306 2857 0.1916 -0.0578 0.01157
ran_pars mother_pidlink sd__(Intercept) 0.118 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2361 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8848 0.1719 -5.148 3740 0.0000002768 -1.222 -0.548
fixed NA poly(age, 3, raw = TRUE)1 0.0948 0.01847 5.132 3734 0.000000302 0.05859 0.131
fixed NA poly(age, 3, raw = TRUE)2 -0.002977 0.0006341 -4.695 3728 0.00000276 -0.00422 -0.001734
fixed NA poly(age, 3, raw = TRUE)3 0.00003121 0.000006968 4.48 3724 0.000007692 0.00001756 0.00004487
fixed NA male -0.0264 0.008617 -3.063 3684 0.002205 -0.04329 -0.009507
fixed NA sibling_count3 0.009706 0.01449 0.6698 3166 0.503 -0.01869 0.0381
fixed NA sibling_count4 0.01476 0.01569 0.9406 3081 0.347 -0.01599 0.0455
fixed NA sibling_count5 0.01424 0.0185 0.7696 2879 0.4416 -0.02202 0.0505
fixed NA sibling_count>5 -0.02438 0.01816 -1.343 2974 0.1795 -0.05996 0.01121
fixed NA birth_order_nonlinear2 -0.01562 0.0111 -1.408 3266 0.1593 -0.03737 0.006128
fixed NA birth_order_nonlinear3 -0.01657 0.01315 -1.26 3333 0.2076 -0.04234 0.009199
fixed NA birth_order_nonlinear4 -0.002065 0.0165 -0.1252 3384 0.9004 -0.0344 0.03027
fixed NA birth_order_nonlinear5 -0.0181 0.02032 -0.891 3355 0.373 -0.05792 0.02172
fixed NA birth_order_nonlinear>5 -0.02136 0.0204 -1.047 3733 0.2952 -0.06135 0.01863
ran_pars mother_pidlink sd__(Intercept) 0.1181 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2362 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.8625 0.1725 -5 3731 0.0000005999 -1.201 -0.5244
fixed NA poly(age, 3, raw = TRUE)1 0.09284 0.01855 5.006 3726 0.0000005806 0.05649 0.1292
fixed NA poly(age, 3, raw = TRUE)2 -0.002912 0.0006367 -4.574 3720 0.000004938 -0.00416 -0.001665
fixed NA poly(age, 3, raw = TRUE)3 0.00003055 0.000006999 4.365 3716 0.00001303 0.00001684 0.00004427
fixed NA male -0.02659 0.008634 -3.08 3673 0.002085 -0.04351 -0.00967
fixed NA count_birth_order2/2 -0.02698 0.02109 -1.28 3379 0.2008 -0.06831 0.01435
fixed NA count_birth_order1/3 0.01649 0.01833 0.8995 3717 0.3685 -0.01944 0.05241
fixed NA count_birth_order2/3 -0.01704 0.02034 -0.8376 3738 0.4023 -0.05691 0.02283
fixed NA count_birth_order3/3 -0.02125 0.02176 -0.9768 3738 0.3287 -0.06389 0.02139
fixed NA count_birth_order1/4 -0.01368 0.02147 -0.6371 3735 0.5241 -0.05575 0.0284
fixed NA count_birth_order2/4 0.0192 0.0224 0.857 3739 0.3915 -0.02471 0.0631
fixed NA count_birth_order3/4 0.004533 0.02346 0.1932 3733 0.8468 -0.04145 0.05051
fixed NA count_birth_order4/4 0.003269 0.02529 0.1293 3727 0.8972 -0.0463 0.05284
fixed NA count_birth_order1/5 0.00178 0.02805 0.06347 3739 0.9494 -0.05319 0.05675
fixed NA count_birth_order2/5 -0.01452 0.03139 -0.4625 3703 0.6437 -0.07603 0.047
fixed NA count_birth_order3/5 -0.009643 0.03007 -0.3207 3709 0.7485 -0.06858 0.0493
fixed NA count_birth_order4/5 0.02184 0.02901 0.753 3715 0.4515 -0.03502 0.0787
fixed NA count_birth_order5/5 0.0006849 0.03053 0.02243 3709 0.9821 -0.05915 0.06052
fixed NA count_birth_order1/>5 -0.02163 0.0273 -0.7922 3729 0.4283 -0.07513 0.03188
fixed NA count_birth_order2/>5 -0.04792 0.0276 -1.736 3705 0.08268 -0.102 0.006187
fixed NA count_birth_order3/>5 -0.03897 0.02643 -1.474 3707 0.1405 -0.09076 0.01283
fixed NA count_birth_order4/>5 -0.03379 0.02627 -1.286 3686 0.1985 -0.08528 0.0177
fixed NA count_birth_order5/>5 -0.05096 0.02487 -2.049 3703 0.04053 -0.09971 -0.002216
fixed NA count_birth_order>5/>5 -0.0495 0.01961 -2.524 3619 0.01165 -0.08793 -0.01106
ran_pars mother_pidlink sd__(Intercept) 0.1183 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2362 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 608.1 676.7 -293 586.1 NA NA NA
12 608.8 683.6 -292.4 584.8 1.244 1 0.2646
16 614.6 714.3 -291.3 582.6 2.283 4 0.6838
26 627.7 789.7 -287.8 575.7 6.885 10 0.7363

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Category_Private worker

birthorder <- birthorder %>% mutate(outcome = `Category_Private worker`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.02918 0.1054 -0.2769 9991 0.7819 -0.2357 0.1774
fixed NA poly(age, 3, raw = TRUE)1 0.05562 0.00946 5.88 9962 0.000000004244 0.03708 0.07416
fixed NA poly(age, 3, raw = TRUE)2 -0.001725 0.000266 -6.484 9882 0.00000000009364 -0.002246 -0.001203
fixed NA poly(age, 3, raw = TRUE)3 0.00001406 0.000002366 5.941 9777 0.00000000293 0.00000942 0.0000187
fixed NA male 0.05526 0.00963 5.738 9792 0.000000009848 0.03639 0.07414
fixed NA sibling_count3 0.0003855 0.02066 0.01865 7198 0.9851 -0.04012 0.04089
fixed NA sibling_count4 -0.008148 0.02089 -0.39 6885 0.6965 -0.04909 0.03279
fixed NA sibling_count5 -0.02683 0.02182 -1.229 6500 0.2191 -0.0696 0.01595
fixed NA sibling_count>5 -0.0556 0.01685 -3.3 7129 0.000973 -0.08863 -0.02258
ran_pars mother_pidlink sd__(Intercept) 0.2157 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4361 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.02842 0.1054 -0.2697 9988 0.7874 -0.235 0.1781
fixed NA birth_order -0.002304 0.00199 -1.158 9712 0.247 -0.006205 0.001597
fixed NA poly(age, 3, raw = TRUE)1 0.05627 0.009476 5.938 9955 0.000000002977 0.0377 0.07485
fixed NA poly(age, 3, raw = TRUE)2 -0.00175 0.0002668 -6.556 9850 0.00000000005792 -0.002273 -0.001227
fixed NA poly(age, 3, raw = TRUE)3 0.00001429 0.000002374 6.017 9728 0.000000001842 0.000009633 0.00001894
fixed NA male 0.05529 0.00963 5.741 9792 0.000000009677 0.03641 0.07416
fixed NA sibling_count3 0.0009427 0.02067 0.04561 7210 0.9636 -0.03957 0.04145
fixed NA sibling_count4 -0.006841 0.02092 -0.327 6933 0.7436 -0.04784 0.03416
fixed NA sibling_count5 -0.02445 0.02192 -1.116 6593 0.2646 -0.06741 0.0185
fixed NA sibling_count>5 -0.04769 0.01819 -2.622 7951 0.008757 -0.08333 -0.01204
ran_pars mother_pidlink sd__(Intercept) 0.2156 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4362 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.02558 0.1055 -0.2424 9990 0.8085 -0.2324 0.1813
fixed NA poly(age, 3, raw = TRUE)1 0.0563 0.009484 5.937 9955 0.000000003009 0.03771 0.07489
fixed NA poly(age, 3, raw = TRUE)2 -0.001739 0.000267 -6.513 9853 0.00000000007739 -0.002262 -0.001215
fixed NA poly(age, 3, raw = TRUE)3 0.00001409 0.000002375 5.932 9727 0.000000003098 0.000009435 0.00001875
fixed NA male 0.0553 0.009632 5.741 9789 0.000000009688 0.03642 0.07417
fixed NA sibling_count3 0.003277 0.02094 0.1565 7452 0.8756 -0.03777 0.04432
fixed NA sibling_count4 -0.003538 0.02142 -0.1652 7368 0.8688 -0.04552 0.03844
fixed NA sibling_count5 -0.02212 0.02258 -0.9795 7141 0.3274 -0.06639 0.02214
fixed NA sibling_count>5 -0.04829 0.01897 -2.546 8548 0.01092 -0.08548 -0.01111
fixed NA birth_order_nonlinear2 -0.02808 0.01393 -2.016 9115 0.04385 -0.05538 -0.000778
fixed NA birth_order_nonlinear3 -0.02067 0.01617 -1.278 8868 0.2011 -0.05235 0.01102
fixed NA birth_order_nonlinear4 -0.02172 0.01816 -1.196 8925 0.2318 -0.05731 0.01388
fixed NA birth_order_nonlinear5 -0.01489 0.02044 -0.7284 8924 0.4664 -0.05494 0.02517
fixed NA birth_order_nonlinear>5 -0.02235 0.01718 -1.301 10022 0.1932 -0.05603 0.01132
ran_pars mother_pidlink sd__(Intercept) 0.2154 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4363 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.02217 0.1059 -0.2094 9987 0.8342 -0.2298 0.1854
fixed NA poly(age, 3, raw = TRUE)1 0.05677 0.009494 5.98 9946 0.00000000231 0.03816 0.07538
fixed NA poly(age, 3, raw = TRUE)2 -0.001744 0.0002672 -6.528 9842 0.00000000006976 -0.002268 -0.001221
fixed NA poly(age, 3, raw = TRUE)3 0.00001406 0.000002377 5.916 9714 0.000000003415 0.000009403 0.00001872
fixed NA male 0.05551 0.009637 5.76 9778 0.000000008674 0.03662 0.0744
fixed NA count_birth_order2/2 -0.05724 0.02767 -2.068 9195 0.03862 -0.1115 -0.003003
fixed NA count_birth_order1/3 0.0003303 0.02726 0.01212 9871 0.9903 -0.05309 0.05375
fixed NA count_birth_order2/3 -0.03185 0.03017 -1.056 9973 0.2911 -0.09097 0.02727
fixed NA count_birth_order3/3 -0.04859 0.03309 -1.469 10036 0.142 -0.1134 0.01626
fixed NA count_birth_order1/4 -0.005195 0.02981 -0.1743 9970 0.8617 -0.06363 0.05324
fixed NA count_birth_order2/4 -0.03899 0.03194 -1.221 10016 0.2222 -0.1016 0.02361
fixed NA count_birth_order3/4 -0.0355 0.03402 -1.043 10052 0.2968 -0.1022 0.03118
fixed NA count_birth_order4/4 -0.0587 0.03611 -1.626 10065 0.1041 -0.1295 0.01207
fixed NA count_birth_order1/5 -0.02741 0.0338 -0.8109 10040 0.4174 -0.09366 0.03884
fixed NA count_birth_order2/5 -0.06241 0.03582 -1.742 10057 0.08148 -0.1326 0.007795
fixed NA count_birth_order3/5 -0.07078 0.03768 -1.879 10069 0.06033 -0.1446 0.003066
fixed NA count_birth_order4/5 -0.03619 0.03954 -0.9152 10062 0.3601 -0.1137 0.04131
fixed NA count_birth_order5/5 -0.0552 0.03957 -1.395 10070 0.163 -0.1327 0.02235
fixed NA count_birth_order1/>5 -0.08694 0.026 -3.343 10066 0.000831 -0.1379 -0.03597
fixed NA count_birth_order2/>5 -0.07812 0.02706 -2.887 10071 0.003892 -0.1312 -0.02509
fixed NA count_birth_order3/>5 -0.06474 0.02665 -2.429 10071 0.01516 -0.117 -0.0125
fixed NA count_birth_order4/>5 -0.07889 0.0262 -3.012 10069 0.002605 -0.1302 -0.02755
fixed NA count_birth_order5/>5 -0.07251 0.02647 -2.739 10071 0.006175 -0.1244 -0.02062
fixed NA count_birth_order>5/>5 -0.08181 0.0217 -3.77 9130 0.0001646 -0.1243 -0.03927
ran_pars mother_pidlink sd__(Intercept) 0.2159 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4362 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 13876 13956 -6927 13854 NA NA NA
12 13877 13964 -6927 13853 1.343 1 0.2466
16 13882 13997 -6925 13850 3.301 4 0.5088
26 13895 14083 -6922 13843 6.494 10 0.7722

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.026 0.3156 -6.419 3807 0.0000000001543 -2.644 -1.407
fixed NA poly(age, 3, raw = TRUE)1 0.2738 0.03387 8.083 3798 8.427e-16 0.2074 0.3402
fixed NA poly(age, 3, raw = TRUE)2 -0.008982 0.001162 -7.732 3789 1.346e-14 -0.01126 -0.006705
fixed NA poly(age, 3, raw = TRUE)3 0.00009119 0.00001275 7.151 3784 1.026e-12 0.0000662 0.0001162
fixed NA male 0.03804 0.01584 2.401 3733 0.01642 0.00698 0.06909
fixed NA sibling_count3 -0.03885 0.0269 -1.444 3023 0.1488 -0.09158 0.01387
fixed NA sibling_count4 -0.03699 0.02791 -1.325 2860 0.1852 -0.09169 0.01771
fixed NA sibling_count5 -0.07355 0.03119 -2.358 2618 0.01842 -0.1347 -0.01243
fixed NA sibling_count>5 -0.1243 0.02709 -4.59 2611 0.000004649 -0.1774 -0.07124
ran_pars mother_pidlink sd__(Intercept) 0.2278 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4351 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.023 0.3157 -6.408 3807 0.0000000001656 -2.642 -1.404
fixed NA birth_order 0.002475 0.00498 0.4971 3809 0.6192 -0.007285 0.01224
fixed NA poly(age, 3, raw = TRUE)1 0.2732 0.0339 8.058 3800 1.032e-15 0.2067 0.3396
fixed NA poly(age, 3, raw = TRUE)2 -0.008966 0.001162 -7.714 3791 1.549e-14 -0.01124 -0.006688
fixed NA poly(age, 3, raw = TRUE)3 0.00009112 0.00001275 7.145 3784 1.076e-12 0.00006613 0.0001161
fixed NA male 0.03797 0.01585 2.396 3731 0.01663 0.006908 0.06903
fixed NA sibling_count3 -0.04015 0.02703 -1.485 3026 0.1376 -0.09314 0.01283
fixed NA sibling_count4 -0.0398 0.02848 -1.398 2869 0.1624 -0.09562 0.01602
fixed NA sibling_count5 -0.07815 0.03254 -2.402 2675 0.01638 -0.1419 -0.01438
fixed NA sibling_count>5 -0.1334 0.03264 -4.087 2813 0.00004497 -0.1973 -0.06941
ran_pars mother_pidlink sd__(Intercept) 0.228 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4351 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.027 0.3161 -6.411 3803 0.0000000001622 -2.646 -1.407
fixed NA poly(age, 3, raw = TRUE)1 0.2741 0.03392 8.08 3794 8.631e-16 0.2076 0.3405
fixed NA poly(age, 3, raw = TRUE)2 -0.009001 0.001163 -7.739 3786 1.281e-14 -0.01128 -0.006721
fixed NA poly(age, 3, raw = TRUE)3 0.00009161 0.00001277 7.176 3779 8.608e-13 0.00006659 0.0001166
fixed NA male 0.0381 0.01585 2.403 3728 0.0163 0.007026 0.06917
fixed NA sibling_count3 -0.03972 0.02752 -1.443 3119 0.149 -0.09365 0.01421
fixed NA sibling_count4 -0.03822 0.0294 -1.3 3034 0.1937 -0.09584 0.0194
fixed NA sibling_count5 -0.08413 0.03393 -2.48 2908 0.0132 -0.1506 -0.01764
fixed NA sibling_count>5 -0.1433 0.03342 -4.287 2932 0.00001866 -0.2088 -0.07778
fixed NA birth_order_nonlinear2 -0.00469 0.02067 -0.2269 3256 0.8205 -0.0452 0.03582
fixed NA birth_order_nonlinear3 0.002097 0.02435 0.08612 3324 0.9314 -0.04563 0.04982
fixed NA birth_order_nonlinear4 -0.001416 0.0297 -0.04766 3380 0.962 -0.05964 0.0568
fixed NA birth_order_nonlinear5 0.04611 0.03654 1.262 3376 0.207 -0.0255 0.1177
fixed NA birth_order_nonlinear>5 0.0272 0.03676 0.7398 3797 0.4595 -0.04486 0.09925
ran_pars mother_pidlink sd__(Intercept) 0.2275 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4354 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.078 0.3173 -6.548 3794 0.00000000006596 -2.7 -1.456
fixed NA poly(age, 3, raw = TRUE)1 0.2796 0.03406 8.211 3785 2.978e-16 0.2129 0.3464
fixed NA poly(age, 3, raw = TRUE)2 -0.009203 0.001168 -7.879 3777 4.295e-15 -0.01149 -0.006913
fixed NA poly(age, 3, raw = TRUE)3 0.00009392 0.00001282 7.324 3771 2.933e-13 0.00006879 0.0001191
fixed NA male 0.03892 0.01588 2.451 3717 0.01428 0.007802 0.07005
fixed NA count_birth_order2/2 0.005079 0.04026 0.1262 3419 0.8996 -0.07383 0.08399
fixed NA count_birth_order1/3 -0.02901 0.03467 -0.8367 3776 0.4028 -0.09695 0.03894
fixed NA count_birth_order2/3 -0.04598 0.03843 -1.197 3803 0.2315 -0.1213 0.02933
fixed NA count_birth_order3/3 -0.0427 0.04151 -1.029 3807 0.3037 -0.1241 0.03866
fixed NA count_birth_order1/4 -0.01582 0.03976 -0.3978 3799 0.6908 -0.09375 0.06211
fixed NA count_birth_order2/4 -0.03676 0.04174 -0.8806 3807 0.3786 -0.1186 0.04506
fixed NA count_birth_order3/4 -0.02532 0.04372 -0.579 3801 0.5626 -0.111 0.06038
fixed NA count_birth_order4/4 -0.08068 0.04636 -1.74 3796 0.08189 -0.1715 0.01018
fixed NA count_birth_order1/5 -0.07601 0.05206 -1.46 3806 0.1444 -0.178 0.02603
fixed NA count_birth_order2/5 -0.1138 0.05651 -2.014 3772 0.04407 -0.2246 -0.00306
fixed NA count_birth_order3/5 -0.03707 0.05297 -0.6999 3783 0.4841 -0.1409 0.06674
fixed NA count_birth_order4/5 -0.1023 0.05152 -1.986 3782 0.04706 -0.2033 -0.001362
fixed NA count_birth_order5/5 -0.03525 0.054 -0.6528 3774 0.5139 -0.1411 0.07058
fixed NA count_birth_order1/>5 -0.1897 0.04946 -3.835 3795 0.0001275 -0.2866 -0.09274
fixed NA count_birth_order2/>5 -0.13 0.04983 -2.609 3768 0.009127 -0.2277 -0.03232
fixed NA count_birth_order3/>5 -0.1686 0.0487 -3.462 3762 0.0005426 -0.264 -0.07314
fixed NA count_birth_order4/>5 -0.08096 0.04728 -1.712 3751 0.08691 -0.1736 0.0117
fixed NA count_birth_order5/>5 -0.09381 0.04561 -2.057 3764 0.03978 -0.1832 -0.004414
fixed NA count_birth_order>5/>5 -0.1121 0.03598 -3.115 3683 0.001852 -0.1826 -0.04156
ran_pars mother_pidlink sd__(Intercept) 0.2282 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4353 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 5366 5435 -2672 5344 NA NA NA
12 5368 5443 -2672 5344 0.2466 1 0.6195
16 5374 5474 -2671 5342 2.082 4 0.7207
26 5386 5549 -2667 5334 8.045 10 0.6245

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.018 0.3145 -6.417 3833 0.000000000156 -2.635 -1.402
fixed NA poly(age, 3, raw = TRUE)1 0.272 0.03379 8.048 3824 1.113e-15 0.2057 0.3382
fixed NA poly(age, 3, raw = TRUE)2 -0.008924 0.001159 -7.699 3815 1.737e-14 -0.0112 -0.006652
fixed NA poly(age, 3, raw = TRUE)3 0.00009054 0.00001273 7.114 3810 1.339e-12 0.00006559 0.0001155
fixed NA male 0.03847 0.0158 2.434 3757 0.01497 0.007495 0.06945
fixed NA sibling_count3 -0.01225 0.02948 -0.4156 3097 0.6777 -0.07003 0.04553
fixed NA sibling_count4 -0.02102 0.0298 -0.7053 2984 0.4807 -0.07942 0.03739
fixed NA sibling_count5 -0.04856 0.03152 -1.541 2814 0.1235 -0.1103 0.01322
fixed NA sibling_count>5 -0.09925 0.02759 -3.598 2894 0.0003267 -0.1533 -0.04518
ran_pars mother_pidlink sd__(Intercept) 0.2287 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4351 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.02 0.3146 -6.42 3833 0.0000000001529 -2.636 -1.403
fixed NA birth_order -0.001348 0.004409 -0.3058 3789 0.7598 -0.009989 0.007293
fixed NA poly(age, 3, raw = TRUE)1 0.2723 0.03381 8.053 3825 1.07e-15 0.206 0.3386
fixed NA poly(age, 3, raw = TRUE)2 -0.008932 0.00116 -7.703 3817 1.681e-14 -0.0112 -0.00666
fixed NA poly(age, 3, raw = TRUE)3 0.00009057 0.00001273 7.115 3810 1.328e-12 0.00006562 0.0001155
fixed NA male 0.0385 0.01581 2.436 3756 0.01491 0.007519 0.06948
fixed NA sibling_count3 -0.01153 0.02958 -0.3896 3095 0.6968 -0.0695 0.04645
fixed NA sibling_count4 -0.01958 0.03017 -0.6491 2979 0.5163 -0.07871 0.03954
fixed NA sibling_count5 -0.04622 0.03244 -1.425 2831 0.1543 -0.1098 0.01735
fixed NA sibling_count>5 -0.09442 0.03179 -2.971 2978 0.002996 -0.1567 -0.03212
ran_pars mother_pidlink sd__(Intercept) 0.2286 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4352 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.011 0.315 -6.386 3829 0.0000000001908 -2.629 -1.394
fixed NA poly(age, 3, raw = TRUE)1 0.2716 0.03383 8.03 3820 1.288e-15 0.2053 0.3379
fixed NA poly(age, 3, raw = TRUE)2 -0.008913 0.00116 -7.682 3812 1.985e-14 -0.01119 -0.006639
fixed NA poly(age, 3, raw = TRUE)3 0.00009045 0.00001274 7.1 3806 1.486e-12 0.00006548 0.0001154
fixed NA male 0.03842 0.01581 2.43 3752 0.01514 0.007433 0.06941
fixed NA sibling_count3 -0.01008 0.03005 -0.3354 3170 0.7373 -0.06897 0.04881
fixed NA sibling_count4 -0.01969 0.03098 -0.6358 3108 0.525 -0.08041 0.04102
fixed NA sibling_count5 -0.05592 0.03372 -1.658 3026 0.09734 -0.122 0.01017
fixed NA sibling_count>5 -0.103 0.03261 -3.158 3100 0.001604 -0.1669 -0.03907
fixed NA birth_order_nonlinear2 -0.01341 0.02097 -0.6398 3314 0.5224 -0.05451 0.02768
fixed NA birth_order_nonlinear3 -0.01003 0.02451 -0.409 3391 0.6826 -0.05807 0.03802
fixed NA birth_order_nonlinear4 0.000195 0.02903 0.006718 3451 0.9946 -0.0567 0.05709
fixed NA birth_order_nonlinear5 0.04181 0.03537 1.182 3453 0.2373 -0.02752 0.1111
fixed NA birth_order_nonlinear>5 -0.009151 0.0333 -0.2748 3842 0.7835 -0.07443 0.05612
ran_pars mother_pidlink sd__(Intercept) 0.228 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4355 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.009 0.3158 -6.363 3820 0.000000000221 -2.628 -1.39
fixed NA poly(age, 3, raw = TRUE)1 0.2733 0.03392 8.058 3811 1.029e-15 0.2068 0.3398
fixed NA poly(age, 3, raw = TRUE)2 -0.008987 0.001164 -7.723 3804 1.445e-14 -0.01127 -0.006706
fixed NA poly(age, 3, raw = TRUE)3 0.00009141 0.00001278 7.153 3798 1.015e-12 0.00006637 0.0001165
fixed NA male 0.03913 0.01584 2.471 3740 0.01353 0.008089 0.07016
fixed NA count_birth_order2/2 -0.05345 0.04441 -1.204 3543 0.2288 -0.1405 0.03359
fixed NA count_birth_order1/3 -0.01953 0.03832 -0.5096 3802 0.6104 -0.09464 0.05558
fixed NA count_birth_order2/3 -0.04084 0.04163 -0.981 3827 0.3266 -0.1224 0.04075
fixed NA count_birth_order3/3 -0.03316 0.04571 -0.7255 3833 0.4682 -0.1228 0.05643
fixed NA count_birth_order1/4 -0.04812 0.04163 -1.156 3819 0.2478 -0.1297 0.03348
fixed NA count_birth_order2/4 -0.03541 0.04338 -0.8163 3832 0.4144 -0.1204 0.04962
fixed NA count_birth_order3/4 -0.01073 0.04735 -0.2265 3827 0.8208 -0.1035 0.08208
fixed NA count_birth_order4/4 -0.05686 0.05053 -1.125 3821 0.2605 -0.1559 0.04216
fixed NA count_birth_order1/5 -0.04768 0.04983 -0.9569 3833 0.3387 -0.1453 0.04998
fixed NA count_birth_order2/5 -0.08619 0.05169 -1.667 3827 0.09552 -0.1875 0.01512
fixed NA count_birth_order3/5 -0.05817 0.05257 -1.106 3816 0.2686 -0.1612 0.04488
fixed NA count_birth_order4/5 -0.129 0.05342 -2.416 3803 0.01575 -0.2338 -0.02435
fixed NA count_birth_order5/5 -0.009836 0.05381 -0.1828 3804 0.855 -0.1153 0.09563
fixed NA count_birth_order1/>5 -0.1407 0.04506 -3.123 3833 0.001805 -0.229 -0.0524
fixed NA count_birth_order2/>5 -0.1041 0.04751 -2.191 3809 0.02852 -0.1972 -0.01097
fixed NA count_birth_order3/>5 -0.1657 0.04577 -3.621 3813 0.0002976 -0.2554 -0.07601
fixed NA count_birth_order4/>5 -0.06336 0.04463 -1.42 3810 0.1558 -0.1508 0.02411
fixed NA count_birth_order5/>5 -0.08578 0.04716 -1.819 3786 0.06897 -0.1782 0.00664
fixed NA count_birth_order>5/>5 -0.1241 0.03602 -3.446 3709 0.000575 -0.1947 -0.05354
ran_pars mother_pidlink sd__(Intercept) 0.2294 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.435 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 5409 5477 -2693 5387 NA NA NA
12 5410 5486 -2693 5386 0.09448 1 0.7586
16 5416 5516 -2692 5384 2.809 4 0.5902
26 5426 5589 -2687 5374 9.447 10 0.4903

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.997 0.3192 -6.256 3740 0.0000000004382 -2.622 -1.371
fixed NA poly(age, 3, raw = TRUE)1 0.2714 0.03431 7.912 3731 3.319e-15 0.2042 0.3387
fixed NA poly(age, 3, raw = TRUE)2 -0.008929 0.001178 -7.582 3723 4.27e-14 -0.01124 -0.006621
fixed NA poly(age, 3, raw = TRUE)3 0.00009099 0.00001294 7.031 3717 2.431e-12 0.00006562 0.0001164
fixed NA male 0.0349 0.01601 2.18 3667 0.02929 0.003529 0.06628
fixed NA sibling_count3 -0.04555 0.02637 -1.727 2984 0.08422 -0.09725 0.006137
fixed NA sibling_count4 -0.04056 0.02775 -1.462 2813 0.144 -0.09495 0.01383
fixed NA sibling_count5 -0.0787 0.03189 -2.468 2508 0.01366 -0.1412 -0.01619
fixed NA sibling_count>5 -0.1247 0.02725 -4.577 2512 0.000004941 -0.1781 -0.07132
ran_pars mother_pidlink sd__(Intercept) 0.227 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.436 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.994 0.3193 -6.245 3740 0.0000000004712 -2.62 -1.368
fixed NA birth_order 0.002076 0.005125 0.405 3747 0.6855 -0.00797 0.01212
fixed NA poly(age, 3, raw = TRUE)1 0.2708 0.03434 7.887 3733 4.043e-15 0.2035 0.3381
fixed NA poly(age, 3, raw = TRUE)2 -0.008913 0.001178 -7.564 3725 4.911e-14 -0.01122 -0.006603
fixed NA poly(age, 3, raw = TRUE)3 0.00009091 0.00001294 7.023 3718 2.568e-12 0.00006554 0.0001163
fixed NA male 0.03489 0.01601 2.18 3665 0.02936 0.003515 0.06627
fixed NA sibling_count3 -0.04667 0.02652 -1.76 2985 0.07857 -0.09865 0.005312
fixed NA sibling_count4 -0.04288 0.02834 -1.513 2826 0.1303 -0.09842 0.01266
fixed NA sibling_count5 -0.08244 0.03322 -2.482 2558 0.01313 -0.1475 -0.01734
fixed NA sibling_count>5 -0.1323 0.03304 -4.004 2758 0.00006399 -0.1971 -0.06753
ran_pars mother_pidlink sd__(Intercept) 0.2272 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.436 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.999 0.3196 -6.253 3736 0.0000000004491 -2.625 -1.372
fixed NA poly(age, 3, raw = TRUE)1 0.2719 0.03435 7.916 3727 3.207e-15 0.2046 0.3393
fixed NA poly(age, 3, raw = TRUE)2 -0.008956 0.001179 -7.596 3719 3.842e-14 -0.01127 -0.006645
fixed NA poly(age, 3, raw = TRUE)3 0.0000915 0.00001295 7.063 3712 1.939e-12 0.00006611 0.0001169
fixed NA male 0.03526 0.01602 2.201 3662 0.02777 0.003867 0.06665
fixed NA sibling_count3 -0.04768 0.02702 -1.764 3078 0.0778 -0.1006 0.005292
fixed NA sibling_count4 -0.04006 0.02926 -1.369 2989 0.1712 -0.09741 0.0173
fixed NA sibling_count5 -0.08599 0.03453 -2.49 2776 0.01282 -0.1537 -0.01831
fixed NA sibling_count>5 -0.1441 0.03388 -4.252 2884 0.00002183 -0.2105 -0.07766
fixed NA birth_order_nonlinear2 -0.008968 0.02059 -0.4354 3181 0.6633 -0.04933 0.0314
fixed NA birth_order_nonlinear3 0.006384 0.02441 0.2616 3255 0.7936 -0.04145 0.05422
fixed NA birth_order_nonlinear4 -0.01746 0.03063 -0.5702 3310 0.5686 -0.0775 0.04257
fixed NA birth_order_nonlinear5 0.03934 0.03771 1.043 3275 0.297 -0.03458 0.1133
fixed NA birth_order_nonlinear>5 0.03292 0.03794 0.8678 3723 0.3856 -0.04143 0.1073
ran_pars mother_pidlink sd__(Intercept) 0.2269 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4362 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -2.036 0.3208 -6.347 3727 0.0000000002462 -2.665 -1.407
fixed NA poly(age, 3, raw = TRUE)1 0.2765 0.03449 8.018 3719 1.432e-15 0.2089 0.3441
fixed NA poly(age, 3, raw = TRUE)2 -0.009123 0.001184 -7.705 3712 1.662e-14 -0.01144 -0.006803
fixed NA poly(age, 3, raw = TRUE)3 0.00009344 0.00001301 7.18 3706 8.36e-13 0.00006793 0.0001189
fixed NA male 0.03622 0.01605 2.257 3650 0.02404 0.004772 0.06768
fixed NA count_birth_order2/2 -0.01423 0.03915 -0.3636 3319 0.7162 -0.09096 0.0625
fixed NA count_birth_order1/3 -0.04654 0.03411 -1.364 3711 0.1726 -0.1134 0.02032
fixed NA count_birth_order2/3 -0.06353 0.03785 -1.678 3738 0.09334 -0.1377 0.01065
fixed NA count_birth_order3/3 -0.04164 0.04047 -1.029 3738 0.3036 -0.121 0.03768
fixed NA count_birth_order1/4 -0.02181 0.03994 -0.546 3734 0.5851 -0.1001 0.05648
fixed NA count_birth_order2/4 -0.03984 0.04167 -0.9562 3739 0.339 -0.1215 0.04183
fixed NA count_birth_order3/4 -0.03702 0.04363 -0.8485 3731 0.3962 -0.1225 0.04849
fixed NA count_birth_order4/4 -0.1064 0.04703 -2.262 3723 0.02376 -0.1986 -0.0142
fixed NA count_birth_order1/5 -0.08905 0.05217 -1.707 3739 0.08791 -0.1913 0.0132
fixed NA count_birth_order2/5 -0.1309 0.05835 -2.243 3692 0.02498 -0.2452 -0.0165
fixed NA count_birth_order3/5 -0.04651 0.05591 -0.8318 3700 0.4056 -0.1561 0.06307
fixed NA count_birth_order4/5 -0.1053 0.05394 -1.953 3708 0.0509 -0.2111 0.0003803
fixed NA count_birth_order5/5 -0.04859 0.05676 -0.856 3700 0.392 -0.1598 0.06266
fixed NA count_birth_order1/>5 -0.1966 0.05077 -3.873 3724 0.0001093 -0.2961 -0.09713
fixed NA count_birth_order2/>5 -0.1305 0.05132 -2.542 3694 0.01106 -0.2311 -0.02987
fixed NA count_birth_order3/>5 -0.1642 0.04914 -3.341 3697 0.0008435 -0.2605 -0.06785
fixed NA count_birth_order4/>5 -0.1132 0.04884 -2.318 3671 0.02048 -0.2089 -0.0175
fixed NA count_birth_order5/>5 -0.1064 0.04624 -2.302 3692 0.0214 -0.1971 -0.01581
fixed NA count_birth_order>5/>5 -0.112 0.03652 -3.067 3606 0.002177 -0.1836 -0.04044
ran_pars mother_pidlink sd__(Intercept) 0.2272 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4363 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 5279 5348 -2629 5257 NA NA NA
12 5281 5356 -2628 5257 0.1631 1 0.6863
16 5286 5386 -2627 5254 2.91 4 0.573
26 5299 5461 -2624 5247 6.613 10 0.7614

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Category_Self-employed

birthorder <- birthorder %>% mutate(outcome = `Category_Self-employed`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2665 0.095 -2.805 9917 0.005038 -0.4527 -0.08029
fixed NA poly(age, 3, raw = TRUE)1 0.02362 0.008521 2.772 9866 0.005576 0.006922 0.04033
fixed NA poly(age, 3, raw = TRUE)2 -0.0001646 0.0002393 -0.6879 9765 0.4915 -0.0006336 0.0003044
fixed NA poly(age, 3, raw = TRUE)3 -0.0000002153 0.000002126 -0.1013 9648 0.9193 -0.000004382 0.000003952
fixed NA male -0.002977 0.008766 -0.3396 9989 0.7342 -0.02016 0.0142
fixed NA sibling_count3 -0.02246 0.01828 -1.229 7683 0.2192 -0.05828 0.01337
fixed NA sibling_count4 -0.01987 0.01844 -1.077 7310 0.2813 -0.056 0.01627
fixed NA sibling_count5 -0.01023 0.01921 -0.5326 6871 0.5944 -0.04789 0.02743
fixed NA sibling_count>5 0.01732 0.0149 1.162 7571 0.2452 -0.01188 0.04651
ran_pars mother_pidlink sd__(Intercept) 0.1531 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4098 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2668 0.09499 -2.809 9915 0.004984 -0.453 -0.08063
fixed NA birth_order 0.002029 0.001784 1.137 9196 0.2556 -0.001469 0.005526
fixed NA poly(age, 3, raw = TRUE)1 0.02307 0.008535 2.703 9857 0.006891 0.006339 0.0398
fixed NA poly(age, 3, raw = TRUE)2 -0.0001441 0.00024 -0.6006 9731 0.5481 -0.0006145 0.0003262
fixed NA poly(age, 3, raw = TRUE)3 -0.0000004013 0.000002132 -0.1882 9599 0.8507 -0.00000458 0.000003778
fixed NA male -0.003007 0.008766 -0.3431 9989 0.7315 -0.02019 0.01417
fixed NA sibling_count3 -0.023 0.01828 -1.258 7695 0.2084 -0.05884 0.01283
fixed NA sibling_count4 -0.0211 0.01847 -1.143 7356 0.2532 -0.0573 0.01509
fixed NA sibling_count5 -0.01241 0.01931 -0.6426 6958 0.5205 -0.05025 0.02544
fixed NA sibling_count>5 0.01022 0.01615 0.6328 8281 0.5269 -0.02144 0.04188
ran_pars mother_pidlink sd__(Intercept) 0.1529 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4098 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2752 0.09511 -2.893 9918 0.003821 -0.4616 -0.08877
fixed NA poly(age, 3, raw = TRUE)1 0.02319 0.008541 2.715 9858 0.006636 0.00645 0.03993
fixed NA poly(age, 3, raw = TRUE)2 -0.0001598 0.0002401 -0.6657 9735 0.5056 -0.0006303 0.0003107
fixed NA poly(age, 3, raw = TRUE)3 -0.0000001582 0.000002133 -0.07415 9600 0.9409 -0.000004338 0.000004022
fixed NA male -0.003111 0.008765 -0.3549 9984 0.7227 -0.02029 0.01407
fixed NA sibling_count3 -0.02462 0.01855 -1.327 7932 0.1844 -0.06098 0.01173
fixed NA sibling_count4 -0.02199 0.01896 -1.16 7793 0.2461 -0.05915 0.01517
fixed NA sibling_count5 -0.01296 0.01996 -0.6493 7524 0.5162 -0.05208 0.02616
fixed NA sibling_count>5 0.01309 0.01691 0.7741 8865 0.4389 -0.02005 0.04623
fixed NA birth_order_nonlinear2 0.03823 0.01276 2.997 9348 0.002737 0.01323 0.06324
fixed NA birth_order_nonlinear3 0.01961 0.01483 1.322 9199 0.1861 -0.009457 0.04867
fixed NA birth_order_nonlinear4 0.0146 0.01665 0.877 9276 0.3805 -0.01803 0.04724
fixed NA birth_order_nonlinear5 0.01968 0.01874 1.05 9304 0.2936 -0.01704 0.0564
fixed NA birth_order_nonlinear>5 0.02218 0.01558 1.423 10079 0.1546 -0.008359 0.05271
ran_pars mother_pidlink sd__(Intercept) 0.1529 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4097 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2834 0.09546 -2.969 9918 0.002995 -0.4705 -0.09631
fixed NA poly(age, 3, raw = TRUE)1 0.02291 0.008548 2.68 9849 0.007384 0.006152 0.03966
fixed NA poly(age, 3, raw = TRUE)2 -0.0001582 0.0002402 -0.6585 9723 0.5102 -0.000629 0.0003126
fixed NA poly(age, 3, raw = TRUE)3 -0.000000111 0.000002134 -0.052 9586 0.9585 -0.000004293 0.000004072
fixed NA male -0.003372 0.008769 -0.3845 9975 0.7006 -0.02056 0.01382
fixed NA count_birth_order2/2 0.07421 0.02534 2.928 9275 0.003418 0.02454 0.1239
fixed NA count_birth_order1/3 -0.02418 0.02456 -0.9844 9991 0.3249 -0.07231 0.02396
fixed NA count_birth_order2/3 0.03323 0.02722 1.221 10030 0.2221 -0.02011 0.08657
fixed NA count_birth_order3/3 0.02459 0.02989 0.8229 10053 0.4106 -0.03398 0.08317
fixed NA count_birth_order1/4 0.01501 0.0269 0.5579 10031 0.5769 -0.03772 0.06773
fixed NA count_birth_order2/4 0.005201 0.02884 0.1804 10046 0.8569 -0.05132 0.06173
fixed NA count_birth_order3/4 -0.005191 0.03075 -0.1688 10061 0.8659 -0.06545 0.05507
fixed NA count_birth_order4/4 0.01914 0.03266 0.5862 10066 0.5578 -0.04486 0.08315
fixed NA count_birth_order1/5 0.009117 0.03054 0.2985 10059 0.7653 -0.05074 0.06897
fixed NA count_birth_order2/5 0.04643 0.03238 1.434 10065 0.1517 -0.01704 0.1099
fixed NA count_birth_order3/5 0.03461 0.03409 1.015 10069 0.31 -0.0322 0.1014
fixed NA count_birth_order4/5 -0.01429 0.03583 -0.3989 10068 0.69 -0.08451 0.05593
fixed NA count_birth_order5/5 0.0102 0.03582 0.2846 10071 0.7759 -0.06001 0.0804
fixed NA count_birth_order1/>5 0.03492 0.02352 1.485 10069 0.1377 -0.01118 0.08102
fixed NA count_birth_order2/>5 0.05428 0.02449 2.216 10071 0.02672 0.006268 0.1023
fixed NA count_birth_order3/>5 0.04115 0.02413 1.705 10071 0.0882 -0.006149 0.08844
fixed NA count_birth_order4/>5 0.04521 0.0237 1.907 10070 0.05649 -0.001244 0.09166
fixed NA count_birth_order5/>5 0.04958 0.02396 2.069 10071 0.03857 0.002613 0.09655
fixed NA count_birth_order>5/>5 0.04898 0.01941 2.523 9318 0.01164 0.01094 0.08703
ran_pars mother_pidlink sd__(Intercept) 0.153 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4097 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 11871 11950 -5924 11849 NA NA NA
12 11871 11958 -5924 11847 1.295 1 0.2552
16 11872 11987 -5920 11840 7.919 4 0.0946
26 11883 12071 -5916 11831 8.217 10 0.6077

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9428 0.2612 3.609 3819 0.0003116 0.4307 1.455
fixed NA poly(age, 3, raw = TRUE)1 -0.1058 0.02805 -3.773 3817 0.0001635 -0.1608 -0.05087
fixed NA poly(age, 3, raw = TRUE)2 0.004147 0.0009623 4.309 3815 0.00001678 0.002261 0.006033
fixed NA poly(age, 3, raw = TRUE)3 -0.00004614 0.00001056 -4.368 3814 0.00001288 -0.00006685 -0.00002544
fixed NA male -0.02367 0.01315 -1.8 3785 0.0719 -0.04943 0.0021
fixed NA sibling_count3 0.01552 0.02194 0.7075 3125 0.4793 -0.02747 0.05851
fixed NA sibling_count4 -0.02907 0.02271 -1.28 2946 0.2007 -0.07358 0.01545
fixed NA sibling_count5 0.03856 0.02531 1.524 2677 0.1277 -0.01104 0.08815
fixed NA sibling_count>5 0.04773 0.02198 2.172 2660 0.02998 0.00465 0.09081
ran_pars mother_pidlink sd__(Intercept) 0.1578 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3721 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9413 0.2613 3.602 3819 0.0003195 0.4291 1.453
fixed NA birth_order -0.001447 0.004107 -0.3524 3766 0.7246 -0.009497 0.006603
fixed NA poly(age, 3, raw = TRUE)1 -0.1055 0.02807 -3.759 3817 0.0001733 -0.1605 -0.05049
fixed NA poly(age, 3, raw = TRUE)2 0.004138 0.0009626 4.299 3815 0.00001761 0.002251 0.006025
fixed NA poly(age, 3, raw = TRUE)3 -0.00004611 0.00001057 -4.364 3813 0.00001308 -0.00006682 -0.0000254
fixed NA male -0.02362 0.01315 -1.796 3783 0.07252 -0.04939 0.002152
fixed NA sibling_count3 0.01627 0.02204 0.7382 3124 0.4605 -0.02693 0.05948
fixed NA sibling_count4 -0.02744 0.02318 -1.184 2948 0.2365 -0.07288 0.01799
fixed NA sibling_count5 0.0412 0.02642 1.559 2723 0.119 -0.01058 0.09299
fixed NA sibling_count>5 0.05295 0.02654 1.995 2828 0.04609 0.0009406 0.105
ran_pars mother_pidlink sd__(Intercept) 0.1582 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.372 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9329 0.2617 3.565 3815 0.0003682 0.42 1.446
fixed NA poly(age, 3, raw = TRUE)1 -0.1051 0.02809 -3.742 3812 0.0001852 -0.1602 -0.05006
fixed NA poly(age, 3, raw = TRUE)2 0.004127 0.0009634 4.283 3810 0.00001887 0.002238 0.006015
fixed NA poly(age, 3, raw = TRUE)3 -0.00004607 0.00001058 -4.355 3808 0.00001363 -0.0000668 -0.00002534
fixed NA male -0.02352 0.01315 -1.788 3779 0.07392 -0.0493 0.002267
fixed NA sibling_count3 0.0156 0.02247 0.6942 3214 0.4876 -0.02844 0.05964
fixed NA sibling_count4 -0.02767 0.02398 -1.154 3114 0.2487 -0.07467 0.01933
fixed NA sibling_count5 0.04284 0.02763 1.55 2963 0.1212 -0.01132 0.09699
fixed NA sibling_count>5 0.0613 0.02722 2.252 2955 0.02438 0.007956 0.1147
fixed NA birth_order_nonlinear2 0.01025 0.01727 0.5934 3368 0.553 -0.02361 0.04411
fixed NA birth_order_nonlinear3 0.001374 0.02033 0.06759 3441 0.9461 -0.03848 0.04123
fixed NA birth_order_nonlinear4 -0.002639 0.02479 -0.1065 3498 0.9152 -0.05122 0.04594
fixed NA birth_order_nonlinear5 -0.008891 0.03048 -0.2917 3505 0.7706 -0.06864 0.05086
fixed NA birth_order_nonlinear>5 -0.02557 0.03043 -0.8404 3817 0.4007 -0.08522 0.03407
ran_pars mother_pidlink sd__(Intercept) 0.1581 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3722 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9316 0.2628 3.545 3805 0.000397 0.4166 1.447
fixed NA poly(age, 3, raw = TRUE)1 -0.1065 0.02821 -3.774 3803 0.0001631 -0.1618 -0.05117
fixed NA poly(age, 3, raw = TRUE)2 0.004174 0.0009678 4.313 3801 0.00001652 0.002277 0.006071
fixed NA poly(age, 3, raw = TRUE)3 -0.00004658 0.00001063 -4.383 3800 0.000012 -0.00006741 -0.00002575
fixed NA male -0.02415 0.01318 -1.832 3769 0.067 -0.04998 0.001684
fixed NA count_birth_order2/2 0.05231 0.0336 1.557 3475 0.1196 -0.01355 0.1182
fixed NA count_birth_order1/3 0.03981 0.02861 1.392 3792 0.1641 -0.01626 0.09589
fixed NA count_birth_order2/3 0.03881 0.03176 1.222 3805 0.2218 -0.02344 0.1011
fixed NA count_birth_order3/3 0.01045 0.03434 0.3044 3807 0.7609 -0.05685 0.07775
fixed NA count_birth_order1/4 -0.008259 0.03285 -0.2514 3802 0.8015 -0.07264 0.05612
fixed NA count_birth_order2/4 -0.02985 0.03453 -0.8646 3807 0.3873 -0.09752 0.03782
fixed NA count_birth_order3/4 -0.01272 0.0362 -0.3513 3804 0.7254 -0.08366 0.05823
fixed NA count_birth_order4/4 0.008705 0.03839 0.2267 3801 0.8206 -0.06654 0.08395
fixed NA count_birth_order1/5 0.05321 0.04307 1.235 3807 0.2168 -0.03121 0.1376
fixed NA count_birth_order2/5 0.07654 0.04684 1.634 3790 0.1023 -0.01527 0.1684
fixed NA count_birth_order3/5 0.06749 0.04389 1.538 3795 0.1242 -0.01854 0.1535
fixed NA count_birth_order4/5 0.05473 0.04269 1.282 3794 0.1999 -0.02895 0.1384
fixed NA count_birth_order5/5 0.02978 0.04476 0.6652 3789 0.506 -0.05796 0.1175
fixed NA count_birth_order1/>5 0.07785 0.04095 1.901 3804 0.05738 -0.002414 0.1581
fixed NA count_birth_order2/>5 0.07465 0.04131 1.807 3792 0.07084 -0.006317 0.1556
fixed NA count_birth_order3/>5 0.09799 0.04038 2.426 3787 0.01529 0.01884 0.1771
fixed NA count_birth_order4/>5 0.04506 0.03922 1.149 3779 0.2506 -0.0318 0.1219
fixed NA count_birth_order5/>5 0.07709 0.03782 2.038 3785 0.0416 0.00296 0.1512
fixed NA count_birth_order>5/>5 0.04905 0.0296 1.657 3670 0.09751 -0.008953 0.1071
ran_pars mother_pidlink sd__(Intercept) 0.1579 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3725 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 3908 3977 -1943 3886 NA NA NA
12 3910 3985 -1943 3886 0.122 1 0.7269
16 3917 4017 -1942 3885 1.352 4 0.8525
26 3931 4094 -1940 3879 5.638 10 0.8447

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.917 0.2603 3.523 3846 0.0004316 0.4068 1.427
fixed NA poly(age, 3, raw = TRUE)1 -0.1019 0.02798 -3.642 3843 0.0002737 -0.1567 -0.04707
fixed NA poly(age, 3, raw = TRUE)2 0.004027 0.0009598 4.196 3841 0.00002782 0.002146 0.005909
fixed NA poly(age, 3, raw = TRUE)3 -0.00004496 0.00001054 -4.266 3840 0.00002039 -0.00006562 -0.0000243
fixed NA male -0.02421 0.01311 -1.847 3810 0.06483 -0.04991 0.001481
fixed NA sibling_count3 -0.006695 0.02405 -0.2784 3201 0.7807 -0.05383 0.04044
fixed NA sibling_count4 -0.03614 0.02428 -1.489 3079 0.1366 -0.08372 0.01144
fixed NA sibling_count5 -0.008562 0.02563 -0.3341 2892 0.7383 -0.05879 0.04167
fixed NA sibling_count>5 0.0278 0.02245 1.238 2968 0.2157 -0.0162 0.0718
ran_pars mother_pidlink sd__(Intercept) 0.1587 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.372 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9174 0.2603 3.524 3845 0.0004304 0.4071 1.428
fixed NA birth_order 0.0004435 0.003628 0.1222 3719 0.9027 -0.006668 0.007555
fixed NA poly(age, 3, raw = TRUE)1 -0.102 0.02799 -3.644 3843 0.0002721 -0.1568 -0.04713
fixed NA poly(age, 3, raw = TRUE)2 0.00403 0.0009601 4.197 3841 0.00002769 0.002148 0.005911
fixed NA poly(age, 3, raw = TRUE)3 -0.00004497 0.00001054 -4.266 3839 0.0000204 -0.00006563 -0.00002431
fixed NA male -0.02422 0.01311 -1.848 3809 0.06474 -0.04992 0.001474
fixed NA sibling_count3 -0.006931 0.02413 -0.2872 3197 0.7739 -0.05422 0.04036
fixed NA sibling_count4 -0.03661 0.02457 -1.49 3071 0.1364 -0.08477 0.01156
fixed NA sibling_count5 -0.009323 0.02638 -0.3534 2901 0.7238 -0.06102 0.04238
fixed NA sibling_count>5 0.02623 0.02589 1.013 3022 0.311 -0.02451 0.07696
ran_pars mother_pidlink sd__(Intercept) 0.1587 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3721 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9044 0.2607 3.47 3841 0.0005271 0.3935 1.415
fixed NA poly(age, 3, raw = TRUE)1 -0.1011 0.02801 -3.608 3839 0.0003122 -0.156 -0.04616
fixed NA poly(age, 3, raw = TRUE)2 0.003996 0.0009609 4.159 3836 0.00003269 0.002113 0.00588
fixed NA poly(age, 3, raw = TRUE)3 -0.00004462 0.00001055 -4.229 3835 0.00002404 -0.00006531 -0.00002394
fixed NA male -0.02403 0.01312 -1.832 3804 0.06702 -0.04974 0.001677
fixed NA sibling_count3 -0.01015 0.02454 -0.4134 3267 0.6793 -0.05824 0.03795
fixed NA sibling_count4 -0.03844 0.02528 -1.521 3196 0.1284 -0.08799 0.0111
fixed NA sibling_count5 -0.008874 0.02749 -0.3228 3097 0.7469 -0.06275 0.04501
fixed NA sibling_count>5 0.02904 0.02661 1.091 3148 0.2752 -0.02311 0.08119
fixed NA birth_order_nonlinear2 0.01753 0.01751 1.001 3422 0.3169 -0.01679 0.05185
fixed NA birth_order_nonlinear3 0.01558 0.02045 0.7616 3503 0.4464 -0.02451 0.05566
fixed NA birth_order_nonlinear4 -0.00005851 0.0242 -0.002418 3563 0.9981 -0.04749 0.04737
fixed NA birth_order_nonlinear5 -0.002062 0.02949 -0.06994 3572 0.9442 -0.05986 0.05573
fixed NA birth_order_nonlinear>5 0.002764 0.02752 0.1004 3836 0.92 -0.05118 0.05671
ran_pars mother_pidlink sd__(Intercept) 0.1585 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3722 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.904 0.2612 3.46 3831 0.0005452 0.392 1.416
fixed NA poly(age, 3, raw = TRUE)1 -0.1033 0.02807 -3.68 3829 0.0002365 -0.1583 -0.04828
fixed NA poly(age, 3, raw = TRUE)2 0.004077 0.0009634 4.233 3828 0.00002364 0.002189 0.005966
fixed NA poly(age, 3, raw = TRUE)3 -0.00004555 0.00001058 -4.305 3827 0.00001715 -0.00006629 -0.00002481
fixed NA male -0.02482 0.01313 -1.89 3795 0.05884 -0.05057 0.0009199
fixed NA count_birth_order2/2 0.07947 0.03699 2.148 3581 0.03176 0.006965 0.152
fixed NA count_birth_order1/3 0.02032 0.0316 0.643 3818 0.5202 -0.04161 0.08225
fixed NA count_birth_order2/3 0.04303 0.03437 1.252 3830 0.2107 -0.02433 0.1104
fixed NA count_birth_order3/3 -0.015 0.03778 -0.3971 3833 0.6913 -0.08904 0.05904
fixed NA count_birth_order1/4 0.005795 0.03435 0.1687 3825 0.866 -0.06153 0.07312
fixed NA count_birth_order2/4 -0.0307 0.03584 -0.8566 3832 0.3917 -0.1009 0.03954
fixed NA count_birth_order3/4 -0.0108 0.03917 -0.2758 3830 0.7827 -0.08757 0.06596
fixed NA count_birth_order4/4 -0.006404 0.04181 -0.1532 3827 0.8783 -0.08835 0.07554
fixed NA count_birth_order1/5 0.01609 0.04117 0.3908 3833 0.6959 -0.0646 0.09678
fixed NA count_birth_order2/5 0.01692 0.04276 0.3957 3831 0.6924 -0.06688 0.1007
fixed NA count_birth_order3/5 0.01622 0.04352 0.3728 3825 0.7093 -0.06907 0.1015
fixed NA count_birth_order4/5 0.01776 0.04424 0.4013 3818 0.6882 -0.06896 0.1045
fixed NA count_birth_order5/5 0.02105 0.04457 0.4723 3817 0.6367 -0.0663 0.1084
fixed NA count_birth_order1/>5 0.03557 0.03723 0.9554 3832 0.3394 -0.0374 0.1085
fixed NA count_birth_order2/>5 0.04765 0.03933 1.211 3824 0.2258 -0.02944 0.1247
fixed NA count_birth_order3/>5 0.1171 0.03789 3.092 3824 0.002004 0.04288 0.1914
fixed NA count_birth_order4/>5 0.03739 0.03695 1.012 3821 0.3117 -0.03504 0.1098
fixed NA count_birth_order5/>5 0.03913 0.03908 1.001 3808 0.3167 -0.03746 0.1157
fixed NA count_birth_order>5/>5 0.05174 0.02961 1.747 3707 0.08067 -0.006299 0.1098
ran_pars mother_pidlink sd__(Intercept) 0.1582 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3723 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 3939 4008 -1958 3917 NA NA NA
12 3941 4016 -1958 3917 0.01549 1 0.901
16 3947 4047 -1958 3915 1.543 4 0.8189
26 3955 4118 -1952 3903 11.8 10 0.2988

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9712 0.2646 3.67 3751 0.0002462 0.4525 1.49
fixed NA poly(age, 3, raw = TRUE)1 -0.11 0.02846 -3.864 3749 0.0001135 -0.1657 -0.05418
fixed NA poly(age, 3, raw = TRUE)2 0.004334 0.0009771 4.435 3746 0.000009468 0.002418 0.006249
fixed NA poly(age, 3, raw = TRUE)3 -0.00004871 0.00001074 -4.536 3745 0.000005926 -0.00006976 -0.00002766
fixed NA male -0.02276 0.0133 -1.711 3715 0.08719 -0.04883 0.003314
fixed NA sibling_count3 0.02252 0.02157 1.044 3069 0.2966 -0.01976 0.06479
fixed NA sibling_count4 -0.02657 0.02265 -1.173 2884 0.2409 -0.07097 0.01783
fixed NA sibling_count5 0.03133 0.02594 1.208 2547 0.2273 -0.01952 0.08218
fixed NA sibling_count>5 0.04105 0.02217 1.852 2545 0.06416 -0.002396 0.0845
ran_pars mother_pidlink sd__(Intercept) 0.16 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3726 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9698 0.2647 3.663 3751 0.0002524 0.4509 1.489
fixed NA birth_order -0.001067 0.004238 -0.2517 3715 0.8013 -0.009373 0.007239
fixed NA poly(age, 3, raw = TRUE)1 -0.1097 0.02848 -3.851 3749 0.0001198 -0.1655 -0.05385
fixed NA poly(age, 3, raw = TRUE)2 0.004326 0.0009776 4.425 3747 0.000009919 0.00241 0.006242
fixed NA poly(age, 3, raw = TRUE)3 -0.00004867 0.00001074 -4.531 3745 0.000006041 -0.00006973 -0.00002762
fixed NA male -0.02275 0.0133 -1.71 3713 0.0874 -0.04882 0.00333
fixed NA sibling_count3 0.02308 0.02169 1.064 3067 0.2874 -0.01943 0.0656
fixed NA sibling_count4 -0.02539 0.02314 -1.097 2891 0.2725 -0.07074 0.01996
fixed NA sibling_count5 0.03322 0.02704 1.229 2589 0.2193 -0.01977 0.08622
fixed NA sibling_count>5 0.0449 0.02695 1.666 2763 0.09583 -0.007923 0.09772
ran_pars mother_pidlink sd__(Intercept) 0.1602 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3725 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9616 0.2651 3.628 3747 0.0002899 0.4421 1.481
fixed NA poly(age, 3, raw = TRUE)1 -0.1091 0.0285 -3.828 3744 0.0001314 -0.165 -0.05323
fixed NA poly(age, 3, raw = TRUE)2 0.00431 0.0009784 4.405 3742 0.00001088 0.002392 0.006227
fixed NA poly(age, 3, raw = TRUE)3 -0.00004859 0.00001075 -4.519 3740 0.000006417 -0.00006966 -0.00002751
fixed NA male -0.02281 0.01331 -1.713 3710 0.08675 -0.0489 0.003284
fixed NA sibling_count3 0.02313 0.02213 1.045 3157 0.296 -0.02025 0.06651
fixed NA sibling_count4 -0.02585 0.02394 -1.08 3054 0.2803 -0.07278 0.02107
fixed NA sibling_count5 0.03196 0.02818 1.134 2816 0.2569 -0.02328 0.08719
fixed NA sibling_count>5 0.05248 0.02768 1.896 2897 0.05807 -0.001773 0.1067
fixed NA birth_order_nonlinear2 0.004606 0.01724 0.2672 3285 0.7893 -0.02918 0.03839
fixed NA birth_order_nonlinear3 -0.001029 0.02041 -0.0504 3362 0.9598 -0.04103 0.03897
fixed NA birth_order_nonlinear4 0.001722 0.02559 0.06727 3422 0.9464 -0.04844 0.05189
fixed NA birth_order_nonlinear5 0.003465 0.03152 0.1099 3399 0.9125 -0.05832 0.06525
fixed NA birth_order_nonlinear>5 -0.02943 0.03147 -0.9352 3747 0.3498 -0.09112 0.03225
ran_pars mother_pidlink sd__(Intercept) 0.1602 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3727 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.9503 0.266 3.573 3737 0.000358 0.429 1.472
fixed NA poly(age, 3, raw = TRUE)1 -0.1092 0.0286 -3.819 3735 0.0001361 -0.1653 -0.05318
fixed NA poly(age, 3, raw = TRUE)2 0.004316 0.0009823 4.394 3733 0.00001143 0.002391 0.006241
fixed NA poly(age, 3, raw = TRUE)3 -0.00004867 0.0000108 -4.507 3732 0.000006766 -0.00006983 -0.00002751
fixed NA male -0.0234 0.01334 -1.754 3699 0.07946 -0.04954 0.002743
fixed NA count_birth_order2/2 0.0426 0.03271 1.302 3378 0.193 -0.02152 0.1067
fixed NA count_birth_order1/3 0.04535 0.0282 1.608 3724 0.1078 -0.009916 0.1006
fixed NA count_birth_order2/3 0.04406 0.03134 1.406 3738 0.1598 -0.01736 0.1055
fixed NA count_birth_order3/3 0.01164 0.03353 0.3472 3738 0.7285 -0.05408 0.07737
fixed NA count_birth_order1/4 -0.008358 0.03305 -0.2528 3736 0.8004 -0.07314 0.05643
fixed NA count_birth_order2/4 -0.04096 0.03452 -1.187 3739 0.2355 -0.1086 0.0267
fixed NA count_birth_order3/4 -0.01007 0.03618 -0.2784 3735 0.7807 -0.08097 0.06083
fixed NA count_birth_order4/4 0.02124 0.03901 0.5443 3731 0.5862 -0.05522 0.09769
fixed NA count_birth_order1/5 0.0574 0.04322 1.328 3739 0.1842 -0.02731 0.1421
fixed NA count_birth_order2/5 0.07243 0.04845 1.495 3715 0.1351 -0.02254 0.1674
fixed NA count_birth_order3/5 0.0487 0.04642 1.049 3719 0.2941 -0.04227 0.1397
fixed NA count_birth_order4/5 0.03821 0.04477 0.8534 3722 0.3935 -0.04954 0.126
fixed NA count_birth_order5/5 0.0122 0.04712 0.2589 3717 0.7957 -0.08016 0.1046
fixed NA count_birth_order1/>5 0.05652 0.0421 1.342 3735 0.1795 -0.026 0.139
fixed NA count_birth_order2/>5 0.05222 0.04261 1.225 3719 0.2205 -0.0313 0.1357
fixed NA count_birth_order3/>5 0.09224 0.04079 2.261 3719 0.02382 0.01228 0.1722
fixed NA count_birth_order4/>5 0.03775 0.04057 0.9304 3703 0.3522 -0.04177 0.1173
fixed NA count_birth_order5/>5 0.0893 0.0384 2.326 3713 0.02009 0.01404 0.1646
fixed NA count_birth_order>5/>5 0.0354 0.0301 1.176 3588 0.2396 -0.02359 0.09438
ran_pars mother_pidlink sd__(Intercept) 0.1598 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3729 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 3861 3930 -1919 3839 NA NA NA
12 3863 3938 -1919 3839 0.06169 1 0.8038
16 3870 3969 -1919 3838 1.332 4 0.856
26 3882 4044 -1915 3830 8.08 10 0.6211

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Category_Unpaid family worker

birthorder <- birthorder %>% mutate(outcome = `Category_Unpaid family worker`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.174 0.06645 17.66 9941 8.86e-69 1.044 1.304
fixed NA poly(age, 3, raw = TRUE)1 -0.0784 0.005963 -13.15 9896 3.758e-39 -0.09008 -0.06671
fixed NA poly(age, 3, raw = TRUE)2 0.001808 0.0001676 10.79 9796 5.516e-27 0.001479 0.002136
fixed NA poly(age, 3, raw = TRUE)3 -0.00001311 0.00000149 -8.799 9672 1.618e-18 -0.00001603 -0.00001019
fixed NA male -0.09204 0.006103 -15.08 9888 7.898e-51 -0.104 -0.08008
fixed NA sibling_count3 0.01356 0.0129 1.051 7256 0.2933 -0.01173 0.03885
fixed NA sibling_count4 0.01864 0.01303 1.43 6899 0.1527 -0.006901 0.04417
fixed NA sibling_count5 0.02536 0.0136 1.865 6474 0.06216 -0.001285 0.05201
fixed NA sibling_count>5 0.04657 0.01052 4.427 7163 0.000009694 0.02595 0.06718
ran_pars mother_pidlink sd__(Intercept) 0.1222 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2808 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.173 0.06645 17.66 9939 9.994e-69 1.043 1.303
fixed NA birth_order 0.002099 0.001252 1.676 9439 0.09368 -0.000355 0.004553
fixed NA poly(age, 3, raw = TRUE)1 -0.07898 0.005973 -13.22 9888 1.392e-39 -0.09069 -0.06727
fixed NA poly(age, 3, raw = TRUE)2 0.00183 0.0001681 10.89 9761 1.907e-27 0.0015 0.002159
fixed NA poly(age, 3, raw = TRUE)3 -0.00001331 0.000001494 -8.905 9619 6.278e-19 -0.00001624 -0.00001038
fixed NA male -0.09207 0.006102 -15.09 9887 7.137e-51 -0.104 -0.08011
fixed NA sibling_count3 0.01303 0.01291 1.009 7267 0.3129 -0.01227 0.03832
fixed NA sibling_count4 0.0174 0.01305 1.333 6947 0.1825 -0.00818 0.04298
fixed NA sibling_count5 0.02316 0.01366 1.695 6567 0.09009 -0.003617 0.04993
fixed NA sibling_count>5 0.03929 0.01138 3.453 7970 0.0005576 0.01699 0.06159
ran_pars mother_pidlink sd__(Intercept) 0.1223 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2807 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.178 0.06653 17.71 9941 3.766e-69 1.048 1.309
fixed NA poly(age, 3, raw = TRUE)1 -0.07952 0.005977 -13.3 9889 4.805e-40 -0.09123 -0.0678
fixed NA poly(age, 3, raw = TRUE)2 0.001839 0.0001681 10.94 9763 1.056e-27 0.00151 0.002169
fixed NA poly(age, 3, raw = TRUE)3 -0.00001332 0.000001495 -8.914 9618 5.821e-19 -0.00001625 -0.00001039
fixed NA male -0.09203 0.006102 -15.08 9885 7.813e-51 -0.104 -0.08007
fixed NA sibling_count3 0.008595 0.01308 0.657 7520 0.5112 -0.01704 0.03423
fixed NA sibling_count4 0.01064 0.01338 0.7952 7404 0.4265 -0.01558 0.03685
fixed NA sibling_count5 0.01522 0.01409 1.08 7145 0.2802 -0.0124 0.04285
fixed NA sibling_count>5 0.0316 0.01189 2.658 8599 0.007882 0.008295 0.0549
fixed NA birth_order_nonlinear2 0.01122 0.008852 1.268 9164 0.2048 -0.006126 0.02858
fixed NA birth_order_nonlinear3 0.02609 0.01028 2.537 8952 0.01118 0.005937 0.04624
fixed NA birth_order_nonlinear4 0.02517 0.01155 2.179 9025 0.02934 0.002532 0.0478
fixed NA birth_order_nonlinear5 0.02458 0.01299 1.892 9039 0.05854 -0.0008849 0.05005
fixed NA birth_order_nonlinear>5 0.0255 0.01086 2.347 10058 0.01895 0.004204 0.04679
ran_pars mother_pidlink sd__(Intercept) 0.122 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2808 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 1.183 0.06675 17.73 9940 3.009e-69 1.053 1.314
fixed NA poly(age, 3, raw = TRUE)1 -0.08008 0.005981 -13.39 9878 1.561e-40 -0.09181 -0.06836
fixed NA poly(age, 3, raw = TRUE)2 0.00185 0.0001682 11 9751 5.56e-28 0.001521 0.00218
fixed NA poly(age, 3, raw = TRUE)3 -0.00001336 0.000001495 -8.938 9603 4.688e-19 -0.0000163 -0.00001043
fixed NA male -0.09221 0.006105 -15.1 9876 5.625e-51 -0.1042 -0.08024
fixed NA count_birth_order2/2 0.01891 0.01758 1.076 9167 0.2821 -0.01555 0.05337
fixed NA count_birth_order1/3 0.001989 0.01717 0.1158 9928 0.9078 -0.03166 0.03564
fixed NA count_birth_order2/3 0.01413 0.01902 0.7428 9999 0.4576 -0.02315 0.0514
fixed NA count_birth_order3/3 0.06725 0.02087 3.222 10042 0.001278 0.02634 0.1082
fixed NA count_birth_order1/4 0.01351 0.01879 0.7191 9999 0.4721 -0.02332 0.05035
fixed NA count_birth_order2/4 0.0194 0.02014 0.9631 10029 0.3355 -0.02008 0.05888
fixed NA count_birth_order3/4 0.02846 0.02147 1.326 10055 0.1849 -0.01361 0.07054
fixed NA count_birth_order4/4 0.06085 0.0228 2.67 10065 0.007608 0.01618 0.1055
fixed NA count_birth_order1/5 0.0184 0.02132 0.8626 10049 0.3884 -0.0234 0.06019
fixed NA count_birth_order2/5 0.04596 0.02261 2.033 10061 0.04208 0.001651 0.09026
fixed NA count_birth_order3/5 0.02026 0.02379 0.8517 10069 0.3944 -0.02636 0.06689
fixed NA count_birth_order4/5 0.0333 0.02499 1.333 10065 0.1826 -0.01567 0.08228
fixed NA count_birth_order5/5 0.059 0.02499 2.361 10071 0.01826 0.01001 0.108
fixed NA count_birth_order1/>5 0.04611 0.01642 2.809 10068 0.004985 0.01393 0.07828
fixed NA count_birth_order2/>5 0.04523 0.01709 2.647 10071 0.008138 0.01174 0.07873
fixed NA count_birth_order3/>5 0.0602 0.01683 3.576 10071 0.0003509 0.0272 0.09319
fixed NA count_birth_order4/>5 0.05521 0.01654 3.338 10070 0.0008472 0.02279 0.08762
fixed NA count_birth_order5/>5 0.05467 0.01672 3.27 10071 0.001081 0.0219 0.08743
fixed NA count_birth_order>5/>5 0.06034 0.01362 4.429 9159 0.000009559 0.03364 0.08704
ran_pars mother_pidlink sd__(Intercept) 0.1218 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2808 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 4606 4686 -2292 4584 NA NA NA
12 4605 4692 -2291 4581 2.811 1 0.09361
16 4607 4722 -2287 4575 6.69 4 0.1532
26 4616 4804 -2282 4564 10.22 10 0.4212

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 2.442 0.188 12.99 3820 8.801e-38 2.074 2.81
fixed NA poly(age, 3, raw = TRUE)1 -0.2215 0.02019 -10.97 3818 1.353e-27 -0.2611 -0.1819
fixed NA poly(age, 3, raw = TRUE)2 0.006628 0.0006926 9.57 3816 1.861e-21 0.00527 0.007985
fixed NA poly(age, 3, raw = TRUE)3 -0.00006461 0.000007603 -8.497 3815 2.749e-17 -0.00007951 -0.00004971
fixed NA male -0.03876 0.009466 -4.095 3775 0.00004316 -0.05731 -0.02021
fixed NA sibling_count3 0.02684 0.01573 1.706 2806 0.08803 -0.003987 0.05766
fixed NA sibling_count4 0.05053 0.01628 3.105 2567 0.001926 0.01863 0.08243
fixed NA sibling_count5 0.05469 0.01812 3.018 2230 0.00257 0.01918 0.0902
fixed NA sibling_count>5 0.07393 0.01574 4.699 2206 0.000002782 0.04309 0.1048
ran_pars mother_pidlink sd__(Intercept) 0.1072 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2701 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 2.445 0.188 13 3819 7.481e-38 2.076 2.813
fixed NA birth_order 0.003024 0.002952 1.024 3702 0.3058 -0.002762 0.008809
fixed NA poly(age, 3, raw = TRUE)1 -0.2222 0.0202 -11 3818 1.01e-27 -0.2617 -0.1826
fixed NA poly(age, 3, raw = TRUE)2 0.006644 0.0006927 9.591 3816 1.524e-21 0.005286 0.008002
fixed NA poly(age, 3, raw = TRUE)3 -0.00006465 0.000007603 -8.503 3814 2.61e-17 -0.00007956 -0.00004975
fixed NA male -0.03886 0.009466 -4.105 3774 0.00004124 -0.05741 -0.02031
fixed NA sibling_count3 0.02528 0.0158 1.6 2809 0.1098 -0.005696 0.05626
fixed NA sibling_count4 0.04716 0.01661 2.839 2573 0.004559 0.0146 0.07971
fixed NA sibling_count5 0.04914 0.01892 2.598 2286 0.009449 0.01206 0.08622
fixed NA sibling_count>5 0.06302 0.01901 3.315 2401 0.0009284 0.02577 0.1003
ran_pars mother_pidlink sd__(Intercept) 0.1075 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.27 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 2.444 0.1882 12.99 3816 9.112e-38 2.075 2.813
fixed NA poly(age, 3, raw = TRUE)1 -0.222 0.0202 -10.99 3813 1.111e-27 -0.2616 -0.1824
fixed NA poly(age, 3, raw = TRUE)2 0.006638 0.000693 9.578 3811 1.727e-21 0.005279 0.007996
fixed NA poly(age, 3, raw = TRUE)3 -0.00006456 0.000007608 -8.486 3810 3.025e-17 -0.00007948 -0.00004965
fixed NA male -0.03863 0.009467 -4.08 3770 0.00004587 -0.05718 -0.02007
fixed NA sibling_count3 0.01909 0.0161 1.186 2927 0.2358 -0.01247 0.05065
fixed NA sibling_count4 0.03957 0.01718 2.303 2784 0.02133 0.005902 0.07325
fixed NA sibling_count5 0.0444 0.01979 2.244 2577 0.0249 0.005624 0.08318
fixed NA sibling_count>5 0.05921 0.01949 3.038 2555 0.002407 0.02101 0.09741
fixed NA birth_order_nonlinear2 0.01273 0.01246 1.022 3150 0.3071 -0.01169 0.03714
fixed NA birth_order_nonlinear3 0.03267 0.01466 2.229 3261 0.02589 0.003941 0.0614
fixed NA birth_order_nonlinear4 0.02027 0.01786 1.135 3349 0.2566 -0.01474 0.05528
fixed NA birth_order_nonlinear5 0.004018 0.02197 0.1828 3364 0.8549 -0.03905 0.04708
fixed NA birth_order_nonlinear>5 0.02633 0.02188 1.203 3816 0.2289 -0.01656 0.06922
ran_pars mother_pidlink sd__(Intercept) 0.107 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2701 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 2.448 0.1889 12.96 3806 1.237e-37 2.078 2.819
fixed NA poly(age, 3, raw = TRUE)1 -0.2223 0.02028 -10.96 3804 1.461e-27 -0.2621 -0.1826
fixed NA poly(age, 3, raw = TRUE)2 0.006654 0.0006958 9.563 3802 1.98e-21 0.00529 0.008018
fixed NA poly(age, 3, raw = TRUE)3 -0.00006481 0.00000764 -8.483 3801 3.098e-17 -0.00007979 -0.00004984
fixed NA male -0.03842 0.00948 -4.053 3760 0.00005165 -0.057 -0.01984
fixed NA count_birth_order2/2 0.003413 0.02421 0.141 3296 0.8879 -0.04403 0.05086
fixed NA count_birth_order1/3 0.0001465 0.02055 0.007127 3787 0.9943 -0.04013 0.04043
fixed NA count_birth_order2/3 0.03307 0.02282 1.449 3804 0.1474 -0.01166 0.0778
fixed NA count_birth_order3/3 0.07378 0.02468 2.99 3807 0.002811 0.02541 0.1222
fixed NA count_birth_order1/4 0.05301 0.0236 2.246 3800 0.02477 0.006748 0.09927
fixed NA count_birth_order2/4 0.03648 0.02481 1.47 3807 0.1416 -0.01216 0.08511
fixed NA count_birth_order3/4 0.04578 0.02602 1.759 3802 0.07861 -0.005222 0.09678
fixed NA count_birth_order4/4 0.07534 0.0276 2.73 3799 0.006371 0.02124 0.1294
fixed NA count_birth_order1/5 0.03696 0.03096 1.194 3807 0.2325 -0.02371 0.09764
fixed NA count_birth_order2/5 0.09427 0.03368 2.799 3785 0.005157 0.02825 0.1603
fixed NA count_birth_order3/5 0.05057 0.03156 1.602 3791 0.1092 -0.01129 0.1124
fixed NA count_birth_order4/5 0.0572 0.0307 1.863 3789 0.06249 -0.002967 0.1174
fixed NA count_birth_order5/5 0.04417 0.03219 1.372 3782 0.17 -0.01891 0.1073
fixed NA count_birth_order1/>5 0.06705 0.02944 2.278 3805 0.02279 0.009357 0.1248
fixed NA count_birth_order2/>5 0.06292 0.0297 2.118 3789 0.03421 0.004706 0.1211
fixed NA count_birth_order3/>5 0.101 0.02904 3.479 3781 0.0005098 0.0441 0.1579
fixed NA count_birth_order4/>5 0.06068 0.0282 2.152 3770 0.03149 0.005407 0.116
fixed NA count_birth_order5/>5 0.06101 0.0272 2.243 3777 0.02493 0.007709 0.1143
fixed NA count_birth_order>5/>5 0.08233 0.02124 3.876 3573 0.0001079 0.04071 0.124
ran_pars mother_pidlink sd__(Intercept) 0.107 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2701 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 1386 1455 -682.2 1364 NA NA NA
12 1387 1462 -681.6 1363 1.048 1 0.3059
16 1390 1490 -679.2 1358 4.901 4 0.2976
26 1401 1563 -674.3 1349 9.699 10 0.4672

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 2.464 0.1878 13.13 3846 1.562e-38 2.096 2.832
fixed NA poly(age, 3, raw = TRUE)1 -0.2235 0.02018 -11.07 3844 4.507e-28 -0.263 -0.1839
fixed NA poly(age, 3, raw = TRUE)2 0.00669 0.0006925 9.661 3842 7.831e-22 0.005332 0.008047
fixed NA poly(age, 3, raw = TRUE)3 -0.0000652 0.000007604 -8.574 3841 1.426e-17 -0.0000801 -0.00005029
fixed NA male -0.03937 0.009461 -4.161 3798 0.00003233 -0.05792 -0.02083
fixed NA sibling_count3 0.02618 0.01729 1.514 2889 0.13 -0.007704 0.06007
fixed NA sibling_count4 0.0433 0.01744 2.482 2722 0.01313 0.009104 0.07749
fixed NA sibling_count5 0.03684 0.01841 2.001 2475 0.04545 0.0007636 0.07291
fixed NA sibling_count>5 0.06644 0.01613 4.12 2570 0.00003915 0.03483 0.09805
ran_pars mother_pidlink sd__(Intercept) 0.1083 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2705 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 2.468 0.1877 13.14 3845 1.231e-38 2.1 2.835
fixed NA birth_order 0.004248 0.002612 1.626 3598 0.104 -0.0008725 0.009368
fixed NA poly(age, 3, raw = TRUE)1 -0.2243 0.02018 -11.11 3844 2.88e-28 -0.2639 -0.1848
fixed NA poly(age, 3, raw = TRUE)2 0.00671 0.0006924 9.691 3842 5.88e-22 0.005353 0.008067
fixed NA poly(age, 3, raw = TRUE)3 -0.00006523 0.000007602 -8.581 3840 1.35e-17 -0.00008013 -0.00005033
fixed NA male -0.03948 0.009459 -4.174 3797 0.00003061 -0.05802 -0.02094
fixed NA sibling_count3 0.02393 0.01734 1.38 2888 0.1678 -0.01007 0.05792
fixed NA sibling_count4 0.03886 0.01766 2.201 2716 0.02784 0.00425 0.07346
fixed NA sibling_count5 0.02956 0.01894 1.561 2491 0.1188 -0.007566 0.06669
fixed NA sibling_count>5 0.05138 0.0186 2.763 2636 0.005763 0.01494 0.08783
ran_pars mother_pidlink sd__(Intercept) 0.1085 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2704 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 2.458 0.1878 13.09 3842 2.526e-38 2.09 2.827
fixed NA poly(age, 3, raw = TRUE)1 -0.2232 0.02018 -11.06 3839 5.342e-28 -0.2627 -0.1836
fixed NA poly(age, 3, raw = TRUE)2 0.006673 0.0006925 9.636 3837 9.933e-22 0.005316 0.00803
fixed NA poly(age, 3, raw = TRUE)3 -0.00006486 0.000007605 -8.528 3836 2.115e-17 -0.00007976 -0.00004995
fixed NA male -0.03913 0.009457 -4.137 3792 0.00003588 -0.05766 -0.02059
fixed NA sibling_count3 0.01657 0.01763 0.9395 2980 0.3476 -0.018 0.05113
fixed NA sibling_count4 0.0298 0.01816 1.641 2879 0.101 -0.005797 0.0654
fixed NA sibling_count5 0.02269 0.01975 1.149 2739 0.2505 -0.01601 0.0614
fixed NA sibling_count>5 0.04598 0.01911 2.406 2800 0.01621 0.008519 0.08344
fixed NA birth_order_nonlinear2 0.01053 0.01265 0.8323 3205 0.4053 -0.01426 0.03531
fixed NA birth_order_nonlinear3 0.03994 0.01477 2.705 3330 0.00687 0.011 0.06888
fixed NA birth_order_nonlinear4 0.02845 0.01747 1.629 3422 0.1035 -0.00579 0.06269
fixed NA birth_order_nonlinear5 0.009549 0.02128 0.4487 3438 0.6537 -0.03217 0.05127
fixed NA birth_order_nonlinear>5 0.03222 0.01982 1.625 3824 0.1042 -0.006636 0.07107
ran_pars mother_pidlink sd__(Intercept) 0.1088 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2702 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 2.444 0.1881 12.99 3832 8.715e-38 2.075 2.813
fixed NA poly(age, 3, raw = TRUE)1 -0.2221 0.02022 -10.99 3831 1.132e-27 -0.2617 -0.1825
fixed NA poly(age, 3, raw = TRUE)2 0.00664 0.0006938 9.571 3829 1.845e-21 0.005281 0.008
fixed NA poly(age, 3, raw = TRUE)3 -0.00006454 0.000007622 -8.468 3829 3.5e-17 -0.00007948 -0.00004961
fixed NA male -0.03836 0.009465 -4.052 3785 0.0000517 -0.05691 -0.01981
fixed NA count_birth_order2/2 0.02215 0.02669 0.83 3435 0.4066 -0.03016 0.07447
fixed NA count_birth_order1/3 0.00529 0.02274 0.2326 3813 0.8161 -0.03928 0.04986
fixed NA count_birth_order2/3 0.02414 0.02474 0.9755 3829 0.3294 -0.02436 0.07263
fixed NA count_birth_order3/3 0.09777 0.0272 3.594 3833 0.0003298 0.04445 0.1511
fixed NA count_birth_order1/4 0.05529 0.02473 2.236 3822 0.0254 0.006829 0.1038
fixed NA count_birth_order2/4 0.01373 0.0258 0.5321 3832 0.5947 -0.03684 0.0643
fixed NA count_birth_order3/4 0.06335 0.02821 2.246 3829 0.02477 0.008066 0.1186
fixed NA count_birth_order4/4 0.08211 0.03012 2.727 3825 0.006428 0.02309 0.1411
fixed NA count_birth_order1/5 0.001284 0.02964 0.04333 3833 0.9654 -0.05681 0.05938
fixed NA count_birth_order2/5 0.08761 0.03079 2.845 3830 0.004462 0.02726 0.148
fixed NA count_birth_order3/5 0.05313 0.03135 1.695 3822 0.09017 -0.008308 0.1146
fixed NA count_birth_order4/5 0.05656 0.03187 1.775 3812 0.07603 -0.005906 0.119
fixed NA count_birth_order5/5 0.02284 0.03211 0.7115 3811 0.4768 -0.04008 0.08577
fixed NA count_birth_order1/>5 0.07247 0.0268 2.704 3831 0.006889 0.01993 0.125
fixed NA count_birth_order2/>5 0.06204 0.02833 2.19 3822 0.02862 0.006505 0.1176
fixed NA count_birth_order3/>5 0.07122 0.02729 2.61 3822 0.009099 0.01773 0.1247
fixed NA count_birth_order4/>5 0.06325 0.02662 2.376 3817 0.01754 0.01108 0.1154
fixed NA count_birth_order5/>5 0.06806 0.02816 2.417 3800 0.01568 0.01288 0.1232
fixed NA count_birth_order>5/>5 0.08184 0.02129 3.844 3621 0.0001233 0.04011 0.1236
ran_pars mother_pidlink sd__(Intercept) 0.1072 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2705 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 1418 1487 -697.9 1396 NA NA NA
12 1417 1492 -696.5 1393 2.648 1 0.1037
16 1419 1519 -693.4 1387 6.263 4 0.1804
26 1422 1585 -685 1370 16.78 10 0.07945

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 2.439 0.1895 12.87 3753 3.812e-37 2.068 2.81
fixed NA poly(age, 3, raw = TRUE)1 -0.2205 0.02038 -10.82 3751 6.611e-27 -0.2605 -0.1806
fixed NA poly(age, 3, raw = TRUE)2 0.006576 0.0006996 9.4 3749 9.213e-21 0.005205 0.007948
fixed NA poly(age, 3, raw = TRUE)3 -0.00006393 0.00000769 -8.314 3749 1.276e-16 -0.00007901 -0.00004886
fixed NA male -0.03783 0.009531 -3.97 3710 0.00007337 -0.05651 -0.01915
fixed NA sibling_count3 0.02853 0.01537 1.857 2784 0.06348 -0.001589 0.05865
fixed NA sibling_count4 0.04803 0.01613 2.978 2538 0.002924 0.01642 0.07964
fixed NA sibling_count5 0.06003 0.01844 3.255 2121 0.001151 0.02389 0.09618
fixed NA sibling_count>5 0.07782 0.01576 4.938 2115 0.0000008509 0.04693 0.1087
ran_pars mother_pidlink sd__(Intercept) 0.1061 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2697 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 2.442 0.1895 12.89 3752 3.213e-37 2.071 2.814
fixed NA birth_order 0.002716 0.003029 0.8965 3658 0.37 -0.003222 0.008654
fixed NA poly(age, 3, raw = TRUE)1 -0.2212 0.02039 -10.85 3751 5.051e-27 -0.2612 -0.1812
fixed NA poly(age, 3, raw = TRUE)2 0.006594 0.0006999 9.421 3749 7.577e-21 0.005222 0.007966
fixed NA poly(age, 3, raw = TRUE)3 -0.00006401 0.00000769 -8.323 3748 1.187e-16 -0.00007908 -0.00004893
fixed NA male -0.03786 0.009531 -3.972 3709 0.00007249 -0.05654 -0.01918
fixed NA sibling_count3 0.0271 0.01545 1.754 2785 0.07958 -0.003187 0.05739
fixed NA sibling_count4 0.04504 0.01647 2.735 2549 0.006286 0.01276 0.07732
fixed NA sibling_count5 0.05519 0.01922 2.871 2171 0.00413 0.01752 0.09287
fixed NA sibling_count>5 0.06803 0.01917 3.548 2363 0.0003953 0.03045 0.1056
ran_pars mother_pidlink sd__(Intercept) 0.1063 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2697 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 2.443 0.1897 12.88 3748 3.528e-37 2.071 2.815
fixed NA poly(age, 3, raw = TRUE)1 -0.2215 0.02039 -10.86 3747 4.502e-27 -0.2615 -0.1815
fixed NA poly(age, 3, raw = TRUE)2 0.006599 0.0007002 9.425 3745 7.293e-21 0.005227 0.007972
fixed NA poly(age, 3, raw = TRUE)3 -0.00006404 0.000007695 -8.322 3744 1.202e-16 -0.00007912 -0.00004895
fixed NA male -0.03763 0.009533 -3.948 3706 0.00008039 -0.05632 -0.01895
fixed NA sibling_count3 0.02229 0.01576 1.415 2903 0.1573 -0.008594 0.05318
fixed NA sibling_count4 0.03807 0.01704 2.234 2756 0.02555 0.004672 0.07147
fixed NA sibling_count5 0.05204 0.02004 2.598 2436 0.009446 0.01277 0.09131
fixed NA sibling_count>5 0.06606 0.01968 3.356 2524 0.0008029 0.02748 0.1046
fixed NA birth_order_nonlinear2 0.01948 0.01238 1.573 3092 0.1157 -0.004787 0.04374
fixed NA birth_order_nonlinear3 0.027 0.01465 1.843 3206 0.06546 -0.001718 0.05571
fixed NA birth_order_nonlinear4 0.02471 0.01837 1.345 3298 0.1786 -0.01129 0.06071
fixed NA birth_order_nonlinear5 0.001399 0.02263 0.06181 3271 0.9507 -0.04295 0.04575
fixed NA birth_order_nonlinear>5 0.02411 0.02252 1.071 3749 0.2843 -0.02002 0.06824
ran_pars mother_pidlink sd__(Intercept) 0.1055 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2699 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 2.451 0.1904 12.87 3739 3.825e-37 2.078 2.824
fixed NA poly(age, 3, raw = TRUE)1 -0.2225 0.02047 -10.87 3738 4.073e-27 -0.2626 -0.1824
fixed NA poly(age, 3, raw = TRUE)2 0.006642 0.0007031 9.448 3736 5.925e-21 0.005264 0.00802
fixed NA poly(age, 3, raw = TRUE)3 -0.00006459 0.000007729 -8.357 3736 8.95e-17 -0.00007974 -0.00004945
fixed NA male -0.03784 0.009553 -3.961 3697 0.00007597 -0.05656 -0.01912
fixed NA count_birth_order2/2 0.01989 0.0235 0.8465 3208 0.3973 -0.02616 0.06594
fixed NA count_birth_order1/3 0.008942 0.02016 0.4434 3721 0.6575 -0.03058 0.04846
fixed NA count_birth_order2/3 0.04507 0.02242 2.01 3738 0.04446 0.001131 0.08902
fixed NA count_birth_order3/3 0.07044 0.024 2.935 3738 0.003353 0.02341 0.1175
fixed NA count_birth_order1/4 0.05241 0.02364 2.217 3735 0.0267 0.006072 0.09875
fixed NA count_birth_order2/4 0.04846 0.0247 1.962 3739 0.04989 0.00003909 0.09688
fixed NA count_birth_order3/4 0.04797 0.02589 1.852 3734 0.06404 -0.002785 0.09872
fixed NA count_birth_order4/4 0.07353 0.02793 2.633 3730 0.008497 0.0188 0.1283
fixed NA count_birth_order1/5 0.05752 0.03092 1.86 3739 0.06296 -0.00309 0.1181
fixed NA count_birth_order2/5 0.07077 0.0347 2.04 3712 0.04146 0.002764 0.1388
fixed NA count_birth_order3/5 0.05268 0.03324 1.585 3715 0.1131 -0.01247 0.1178
fixed NA count_birth_order4/5 0.07725 0.03206 2.41 3719 0.01601 0.01442 0.1401
fixed NA count_birth_order5/5 0.07412 0.03375 2.196 3713 0.02812 0.00798 0.1403
fixed NA count_birth_order1/>5 0.07883 0.03014 2.616 3737 0.008934 0.01977 0.1379
fixed NA count_birth_order2/>5 0.09488 0.03051 3.11 3720 0.001888 0.03508 0.1547
fixed NA count_birth_order3/>5 0.1004 0.02921 3.436 3718 0.0005975 0.04311 0.1576
fixed NA count_birth_order4/>5 0.07875 0.02906 2.71 3698 0.006766 0.02179 0.1357
fixed NA count_birth_order5/>5 0.05546 0.0275 2.017 3709 0.04379 0.001564 0.1094
fixed NA count_birth_order>5/>5 0.09005 0.02148 4.192 3478 0.00002835 0.04795 0.1322
ran_pars mother_pidlink sd__(Intercept) 0.1046 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2704 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 1344 1413 -661 1322 NA NA NA
12 1345 1420 -660.6 1321 0.8029 1 0.3702
16 1348 1448 -658.2 1316 4.708 4 0.3186
26 1362 1524 -655.2 1310 6.094 10 0.8073

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Work Sector

Sector_Agriculture, forestry, fishing and hunting

birthorder <- birthorder %>% mutate(outcome = `Sector_Agriculture, forestry, fishing and hunting`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1306 0.0897 1.456 9664 0.1455 -0.04522 0.3064
fixed NA poly(age, 3, raw = TRUE)1 -0.0008862 0.008036 -0.1103 9640 0.9122 -0.01664 0.01486
fixed NA poly(age, 3, raw = TRUE)2 0.0001282 0.0002255 0.5685 9572 0.5697 -0.0003138 0.0005702
fixed NA poly(age, 3, raw = TRUE)3 -0.000001381 0.000002002 -0.6899 9480 0.4903 -0.000005305 0.000002542
fixed NA male 0.02977 0.008213 3.624 9475 0.0002912 0.01367 0.04586
fixed NA sibling_count3 0.00264 0.01767 0.1494 7173 0.8813 -0.032 0.03728
fixed NA sibling_count4 0.0012 0.01789 0.06708 6867 0.9465 -0.03386 0.03626
fixed NA sibling_count5 0.00142 0.01864 0.07615 6516 0.9393 -0.03512 0.03796
fixed NA sibling_count>5 0.01776 0.01442 1.232 7097 0.2182 -0.01051 0.04604
ran_pars mother_pidlink sd__(Intercept) 0.1829 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3648 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1302 0.0897 1.451 9662 0.1468 -0.04566 0.306
fixed NA birth_order 0.001497 0.001692 0.8848 9436 0.3763 -0.001819 0.004812
fixed NA poly(age, 3, raw = TRUE)1 -0.001315 0.008051 -0.1634 9633 0.8702 -0.01709 0.01446
fixed NA poly(age, 3, raw = TRUE)2 0.0001445 0.0002262 0.6385 9544 0.5231 -0.000299 0.0005879
fixed NA poly(age, 3, raw = TRUE)3 -0.00000153 0.000002009 -0.7617 9437 0.4462 -0.000005467 0.000002407
fixed NA male 0.02974 0.008213 3.621 9475 0.0002953 0.01364 0.04584
fixed NA sibling_count3 0.0023 0.01768 0.1301 7182 0.8965 -0.03235 0.03695
fixed NA sibling_count4 0.0003682 0.01791 0.02055 6909 0.9836 -0.03474 0.03547
fixed NA sibling_count5 -0.00009096 0.01872 -0.004859 6600 0.9961 -0.03678 0.0366
fixed NA sibling_count>5 0.01263 0.01555 0.812 7848 0.4168 -0.01785 0.0431
ran_pars mother_pidlink sd__(Intercept) 0.1827 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3649 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1386 0.08983 1.543 9663 0.1228 -0.03742 0.3147
fixed NA poly(age, 3, raw = TRUE)1 -0.001996 0.008057 -0.2477 9634 0.8044 -0.01779 0.0138
fixed NA poly(age, 3, raw = TRUE)2 0.0001671 0.0002264 0.7384 9546 0.4603 -0.0002765 0.0006108
fixed NA poly(age, 3, raw = TRUE)3 -0.000001733 0.00000201 -0.8621 9437 0.3887 -0.000005672 0.000002206
fixed NA male 0.02977 0.008214 3.624 9471 0.0002917 0.01367 0.04587
fixed NA sibling_count3 0.002077 0.01791 0.116 7398 0.9076 -0.03302 0.03717
fixed NA sibling_count4 -0.003051 0.01834 -0.1663 7312 0.8679 -0.039 0.0329
fixed NA sibling_count5 -0.00412 0.01928 -0.2137 7101 0.8308 -0.04191 0.03367
fixed NA sibling_count>5 0.004782 0.01621 0.295 8382 0.768 -0.02699 0.03656
fixed NA birth_order_nonlinear2 -0.004716 0.01189 -0.3967 8886 0.6916 -0.02802 0.01858
fixed NA birth_order_nonlinear3 0.003489 0.01378 0.2532 8648 0.8001 -0.02352 0.0305
fixed NA birth_order_nonlinear4 0.02163 0.0155 1.396 8674 0.1628 -0.008745 0.05201
fixed NA birth_order_nonlinear5 0.0108 0.01742 0.6202 8681 0.5351 -0.02333 0.04494
fixed NA birth_order_nonlinear>5 0.02094 0.01463 1.431 9684 0.1524 -0.007737 0.04962
ran_pars mother_pidlink sd__(Intercept) 0.1826 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3649 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1623 0.09007 1.802 9660 0.07158 -0.01423 0.3388
fixed NA poly(age, 3, raw = TRUE)1 -0.00313 0.008058 -0.3884 9626 0.6977 -0.01892 0.01266
fixed NA poly(age, 3, raw = TRUE)2 0.0001942 0.0002263 0.8581 9537 0.3909 -0.0002494 0.0006378
fixed NA poly(age, 3, raw = TRUE)3 -0.000001913 0.000002009 -0.9523 9426 0.341 -0.000005851 0.000002024
fixed NA male 0.02973 0.00821 3.622 9459 0.0002944 0.01364 0.04582
fixed NA count_birth_order2/2 -0.03256 0.02366 -1.376 8968 0.1687 -0.07893 0.01381
fixed NA count_birth_order1/3 -0.02768 0.02327 -1.19 9551 0.2342 -0.07329 0.01793
fixed NA count_birth_order2/3 -0.02653 0.02583 -1.027 9645 0.3044 -0.07717 0.0241
fixed NA count_birth_order3/3 0.05159 0.02831 1.822 9700 0.06848 -0.003905 0.1071
fixed NA count_birth_order1/4 -0.02445 0.02556 -0.9567 9644 0.3388 -0.07454 0.02564
fixed NA count_birth_order2/4 -0.04134 0.02739 -1.509 9682 0.1312 -0.09502 0.01234
fixed NA count_birth_order3/4 0.03614 0.02885 1.253 9710 0.2103 -0.0204 0.09268
fixed NA count_birth_order4/4 0.007561 0.03102 0.2438 9727 0.8074 -0.05323 0.06836
fixed NA count_birth_order1/5 -0.01458 0.02876 -0.507 9703 0.6122 -0.07096 0.04179
fixed NA count_birth_order2/5 -0.001386 0.03052 -0.04544 9717 0.9638 -0.06119 0.05842
fixed NA count_birth_order3/5 -0.04137 0.03206 -1.29 9729 0.197 -0.1042 0.02148
fixed NA count_birth_order4/5 0.04476 0.03378 1.325 9718 0.1852 -0.02145 0.111
fixed NA count_birth_order5/5 -0.02623 0.03388 -0.7743 9728 0.4388 -0.09264 0.04017
fixed NA count_birth_order1/>5 0.006506 0.02222 0.2929 9726 0.7696 -0.03704 0.05005
fixed NA count_birth_order2/>5 0.02085 0.02307 0.9039 9730 0.3661 -0.02436 0.06606
fixed NA count_birth_order3/>5 -0.04021 0.02283 -1.761 9730 0.07819 -0.08495 0.004531
fixed NA count_birth_order4/>5 0.007129 0.02239 0.3185 9729 0.7501 -0.03675 0.051
fixed NA count_birth_order5/>5 0.01262 0.02261 0.5581 9730 0.5768 -0.0317 0.05694
fixed NA count_birth_order>5/>5 0.01603 0.01858 0.8625 8912 0.3885 -0.02039 0.05244
ran_pars mother_pidlink sd__(Intercept) 0.1828 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3644 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 9969 10049 -4974 9947 NA NA NA
12 9971 10057 -4973 9947 0.7849 1 0.3756
16 9975 10090 -4972 9943 3.619 4 0.4601
26 9966 10153 -4957 9914 28.92 10 0.001283

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2048 0.2492 0.8218 3657 0.4112 -0.2836 0.6932
fixed NA poly(age, 3, raw = TRUE)1 -0.006416 0.02672 -0.2401 3652 0.8102 -0.05878 0.04595
fixed NA poly(age, 3, raw = TRUE)2 0.0002029 0.0009152 0.2217 3647 0.8246 -0.001591 0.001997
fixed NA poly(age, 3, raw = TRUE)3 -0.00000112 0.00001003 -0.1116 3645 0.9111 -0.00002078 0.00001854
fixed NA male 0.01815 0.01255 1.446 3607 0.1482 -0.006448 0.04275
fixed NA sibling_count3 -0.01727 0.02117 -0.8156 2932 0.4148 -0.05875 0.02422
fixed NA sibling_count4 -0.006193 0.02193 -0.2825 2756 0.7776 -0.04917 0.03678
fixed NA sibling_count5 0.005548 0.02456 0.2259 2497 0.8213 -0.04259 0.05369
fixed NA sibling_count>5 0.01615 0.02122 0.7613 2490 0.4466 -0.02543 0.05773
ran_pars mother_pidlink sd__(Intercept) 0.1644 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3417 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2093 0.2493 0.8396 3657 0.4012 -0.2793 0.6979
fixed NA birth_order 0.003167 0.003924 0.8071 3633 0.4197 -0.004523 0.01086
fixed NA poly(age, 3, raw = TRUE)1 -0.007299 0.02674 -0.2729 3653 0.7849 -0.05971 0.04512
fixed NA poly(age, 3, raw = TRUE)2 0.0002263 0.0009157 0.2472 3649 0.8048 -0.001568 0.002021
fixed NA poly(age, 3, raw = TRUE)3 -0.000001234 0.00001003 -0.123 3645 0.9021 -0.0000209 0.00001843
fixed NA male 0.01803 0.01255 1.437 3606 0.1509 -0.00657 0.04263
fixed NA sibling_count3 -0.01886 0.02126 -0.8871 2935 0.3751 -0.06053 0.02281
fixed NA sibling_count4 -0.009734 0.02236 -0.4353 2762 0.6634 -0.05356 0.0341
fixed NA sibling_count5 -0.00025 0.02559 -0.009769 2546 0.9922 -0.05041 0.04991
fixed NA sibling_count>5 0.004629 0.02557 0.181 2664 0.8564 -0.04549 0.05475
ran_pars mother_pidlink sd__(Intercept) 0.1644 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3417 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2063 0.2494 0.8274 3653 0.4081 -0.2824 0.6951
fixed NA poly(age, 3, raw = TRUE)1 -0.007303 0.02673 -0.2732 3648 0.7847 -0.05969 0.04509
fixed NA poly(age, 3, raw = TRUE)2 0.0002221 0.0009154 0.2426 3643 0.8083 -0.001572 0.002016
fixed NA poly(age, 3, raw = TRUE)3 -0.000001135 0.00001003 -0.1131 3640 0.91 -0.0000208 0.00001853
fixed NA male 0.01846 0.01255 1.471 3602 0.1413 -0.006134 0.04306
fixed NA sibling_count3 -0.02808 0.02162 -1.299 3024 0.1941 -0.07046 0.0143
fixed NA sibling_count4 -0.02 0.02309 -0.8659 2927 0.3866 -0.06526 0.02526
fixed NA sibling_count5 -0.004471 0.02665 -0.1678 2779 0.8668 -0.05671 0.04777
fixed NA sibling_count>5 -0.002136 0.02617 -0.08163 2795 0.9349 -0.05342 0.04915
fixed NA birth_order_nonlinear2 0.02484 0.01643 1.512 3174 0.1308 -0.00737 0.05705
fixed NA birth_order_nonlinear3 0.04716 0.01931 2.443 3215 0.01463 0.009321 0.085
fixed NA birth_order_nonlinear4 0.02073 0.02359 0.8784 3261 0.3798 -0.02552 0.06697
fixed NA birth_order_nonlinear5 -0.005032 0.02894 -0.1739 3254 0.862 -0.06176 0.05169
fixed NA birth_order_nonlinear>5 0.04153 0.02893 1.435 3654 0.1513 -0.01518 0.09824
ran_pars mother_pidlink sd__(Intercept) 0.164 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3417 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1737 0.2502 0.6943 3645 0.4875 -0.3167 0.6641
fixed NA poly(age, 3, raw = TRUE)1 -0.003514 0.02683 -0.131 3640 0.8958 -0.0561 0.04907
fixed NA poly(age, 3, raw = TRUE)2 0.00007322 0.000919 0.07967 3637 0.9365 -0.001728 0.001874
fixed NA poly(age, 3, raw = TRUE)3 0.0000006975 0.00001008 0.06922 3635 0.9448 -0.00001905 0.00002045
fixed NA male 0.01881 0.01256 1.498 3595 0.1343 -0.005805 0.04343
fixed NA count_birth_order2/2 0.03164 0.03213 0.9849 3281 0.3247 -0.03133 0.09461
fixed NA count_birth_order1/3 -0.007422 0.02734 -0.2715 3628 0.7861 -0.06101 0.04616
fixed NA count_birth_order2/3 -0.0317 0.03035 -1.045 3646 0.2962 -0.09118 0.02777
fixed NA count_birth_order3/3 0.0254 0.03301 0.7693 3650 0.4417 -0.0393 0.0901
fixed NA count_birth_order1/4 -0.0155 0.03133 -0.4946 3644 0.6209 -0.0769 0.04591
fixed NA count_birth_order2/4 0.009061 0.03316 0.2732 3650 0.7847 -0.05593 0.07406
fixed NA count_birth_order3/4 0.05157 0.03435 1.501 3646 0.1334 -0.01576 0.1189
fixed NA count_birth_order4/4 -0.02999 0.03675 -0.8159 3641 0.4146 -0.102 0.04205
fixed NA count_birth_order1/5 -0.007561 0.0412 -0.1835 3650 0.8544 -0.08831 0.07319
fixed NA count_birth_order2/5 -0.0012 0.04434 -0.02707 3629 0.9784 -0.0881 0.0857
fixed NA count_birth_order3/5 0.04731 0.04215 1.123 3631 0.2617 -0.03529 0.1299
fixed NA count_birth_order4/5 0.05736 0.0411 1.396 3628 0.1629 -0.0232 0.1379
fixed NA count_birth_order5/5 -0.02381 0.04323 -0.5508 3619 0.5818 -0.1085 0.06092
fixed NA count_birth_order1/>5 -0.0458 0.03899 -1.175 3642 0.2403 -0.1222 0.03062
fixed NA count_birth_order2/>5 0.09322 0.03922 2.377 3618 0.01752 0.01634 0.1701
fixed NA count_birth_order3/>5 0.01043 0.03826 0.2726 3617 0.7851 -0.06456 0.08543
fixed NA count_birth_order4/>5 0.02492 0.03743 0.6657 3604 0.5056 -0.04844 0.09828
fixed NA count_birth_order5/>5 0.005131 0.03579 0.1434 3618 0.886 -0.06502 0.07528
fixed NA count_birth_order>5/>5 0.0424 0.02827 1.5 3520 0.1338 -0.01302 0.09782
ran_pars mother_pidlink sd__(Intercept) 0.1621 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3422 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 3263 3332 -1621 3241 NA NA NA
12 3265 3339 -1620 3241 0.6535 1 0.4189
16 3265 3364 -1616 3233 7.902 4 0.09525
26 3271 3432 -1609 3219 14.38 10 0.1564

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2 0.248 0.8065 3681 0.42 -0.286 0.686
fixed NA poly(age, 3, raw = TRUE)1 -0.005978 0.02661 -0.2246 3676 0.8223 -0.05814 0.04618
fixed NA poly(age, 3, raw = TRUE)2 0.0001901 0.0009118 0.2085 3672 0.8349 -0.001597 0.001977
fixed NA poly(age, 3, raw = TRUE)3 -0.0000009767 0.000009998 -0.09769 3670 0.9222 -0.00002057 0.00001862
fixed NA male 0.01874 0.0125 1.499 3631 0.134 -0.005762 0.04324
fixed NA sibling_count3 -0.02278 0.02317 -0.9834 3000 0.3255 -0.06819 0.02262
fixed NA sibling_count4 -0.004367 0.02342 -0.1865 2881 0.8521 -0.05027 0.04154
fixed NA sibling_count5 0.004279 0.02475 0.1729 2716 0.8627 -0.04423 0.05279
fixed NA sibling_count>5 0.009765 0.02168 0.4505 2770 0.6524 -0.03272 0.05225
ran_pars mother_pidlink sd__(Intercept) 0.1641 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3415 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.2047 0.248 0.8255 3681 0.4092 -0.2814 0.6908
fixed NA birth_order 0.003732 0.00347 1.076 3595 0.2822 -0.003069 0.01053
fixed NA poly(age, 3, raw = TRUE)1 -0.006952 0.02663 -0.2611 3677 0.794 -0.05914 0.04524
fixed NA poly(age, 3, raw = TRUE)2 0.0002152 0.0009121 0.236 3673 0.8134 -0.001572 0.002003
fixed NA poly(age, 3, raw = TRUE)3 -0.00000108 0.000009998 -0.108 3670 0.914 -0.00002068 0.00001852
fixed NA male 0.0186 0.0125 1.488 3631 0.1369 -0.005904 0.0431
fixed NA sibling_count3 -0.0247 0.02323 -1.063 2999 0.2879 -0.07023 0.02084
fixed NA sibling_count4 -0.008205 0.02369 -0.3464 2875 0.7291 -0.05464 0.03823
fixed NA sibling_count5 -0.002088 0.02545 -0.08207 2728 0.9346 -0.05196 0.04778
fixed NA sibling_count>5 -0.003568 0.02497 -0.1429 2834 0.8864 -0.05251 0.04537
ran_pars mother_pidlink sd__(Intercept) 0.1639 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3416 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.196 0.2482 0.7895 3677 0.4298 -0.2905 0.6824
fixed NA poly(age, 3, raw = TRUE)1 -0.006367 0.02663 -0.2391 3672 0.811 -0.05856 0.04583
fixed NA poly(age, 3, raw = TRUE)2 0.0001927 0.0009122 0.2113 3668 0.8327 -0.001595 0.001981
fixed NA poly(age, 3, raw = TRUE)3 -0.0000008051 0.00001 -0.0805 3666 0.9358 -0.00002041 0.0000188
fixed NA male 0.01888 0.0125 1.51 3627 0.131 -0.005619 0.04339
fixed NA sibling_count3 -0.03091 0.02358 -1.311 3070 0.19 -0.07713 0.0153
fixed NA sibling_count4 -0.01824 0.02432 -0.7502 2998 0.4532 -0.0659 0.02942
fixed NA sibling_count5 -0.008351 0.02645 -0.3157 2922 0.7522 -0.0602 0.04349
fixed NA sibling_count>5 -0.00879 0.02563 -0.343 2966 0.7316 -0.05902 0.04144
fixed NA birth_order_nonlinear2 0.02643 0.01663 1.589 3225 0.1121 -0.006167 0.05903
fixed NA birth_order_nonlinear3 0.03556 0.01942 1.831 3283 0.06718 -0.002503 0.07363
fixed NA birth_order_nonlinear4 0.04224 0.02305 1.833 3350 0.06695 -0.002935 0.08741
fixed NA birth_order_nonlinear5 0.00225 0.02807 0.08016 3328 0.9361 -0.05276 0.05726
fixed NA birth_order_nonlinear>5 0.03512 0.02623 1.339 3683 0.1806 -0.01628 0.08652
ran_pars mother_pidlink sd__(Intercept) 0.1636 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3417 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1632 0.2485 0.6567 3669 0.5114 -0.3239 0.6503
fixed NA poly(age, 3, raw = TRUE)1 -0.002079 0.02667 -0.07794 3665 0.9379 -0.05436 0.0502
fixed NA poly(age, 3, raw = TRUE)2 0.00001812 0.000914 0.01983 3662 0.9842 -0.001773 0.00181
fixed NA poly(age, 3, raw = TRUE)3 0.000001353 0.00001002 0.135 3660 0.8926 -0.00001829 0.000021
fixed NA male 0.01964 0.01251 1.57 3619 0.1165 -0.004879 0.04415
fixed NA count_birth_order2/2 0.02775 0.03526 0.7871 3393 0.4313 -0.04135 0.09686
fixed NA count_birth_order1/3 -0.01368 0.03019 -0.453 3652 0.6506 -0.07286 0.0455
fixed NA count_birth_order2/3 -0.02855 0.03284 -0.8694 3669 0.3847 -0.09292 0.03582
fixed NA count_birth_order3/3 0.007524 0.03635 0.207 3674 0.836 -0.06372 0.07877
fixed NA count_birth_order1/4 -0.02249 0.03274 -0.6868 3664 0.4923 -0.08666 0.04169
fixed NA count_birth_order2/4 -0.01115 0.03446 -0.3235 3673 0.7463 -0.07868 0.05639
fixed NA count_birth_order3/4 0.08672 0.03724 2.328 3671 0.01994 0.01372 0.1597
fixed NA count_birth_order4/4 -0.01743 0.04042 -0.4312 3664 0.6663 -0.09665 0.06179
fixed NA count_birth_order1/5 0.01313 0.03952 0.3322 3674 0.7397 -0.06433 0.09059
fixed NA count_birth_order2/5 0.02348 0.04048 0.58 3672 0.562 -0.05586 0.1028
fixed NA count_birth_order3/5 0.01464 0.0416 0.3519 3662 0.7249 -0.06689 0.09617
fixed NA count_birth_order4/5 0.04861 0.04232 1.149 3654 0.2508 -0.03434 0.1316
fixed NA count_birth_order5/5 -0.036 0.04295 -0.8381 3648 0.402 -0.1202 0.04819
fixed NA count_birth_order1/>5 -0.04299 0.03567 -1.205 3674 0.2282 -0.1129 0.02692
fixed NA count_birth_order2/>5 0.07643 0.03759 2.034 3656 0.04207 0.002765 0.1501
fixed NA count_birth_order3/>5 -0.02567 0.03621 -0.7089 3659 0.4785 -0.09664 0.0453
fixed NA count_birth_order4/>5 0.05458 0.03517 1.552 3657 0.1208 -0.01435 0.1235
fixed NA count_birth_order5/>5 0.0148 0.03721 0.3979 3638 0.6907 -0.05812 0.08773
fixed NA count_birth_order>5/>5 0.0284 0.02839 1 3552 0.3172 -0.02725 0.08405
ran_pars mother_pidlink sd__(Intercept) 0.1614 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.342 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 3280 3348 -1629 3258 NA NA NA
12 3280 3355 -1628 3256 1.161 1 0.2813
16 3283 3382 -1625 3251 5.449 4 0.2443
26 3282 3444 -1615 3230 20.81 10 0.02245

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1848 0.2525 0.732 3593 0.4642 -0.3101 0.6797
fixed NA poly(age, 3, raw = TRUE)1 -0.004672 0.02712 -0.1723 3587 0.8632 -0.05782 0.04848
fixed NA poly(age, 3, raw = TRUE)2 0.0001606 0.0009297 0.1727 3583 0.8629 -0.001662 0.001983
fixed NA poly(age, 3, raw = TRUE)3 -0.0000009046 0.0000102 -0.08866 3580 0.9294 -0.0000209 0.00001909
fixed NA male 0.01747 0.01271 1.375 3541 0.1691 -0.007427 0.04238
fixed NA sibling_count3 -0.006028 0.0208 -0.2897 2884 0.772 -0.0468 0.03475
fixed NA sibling_count4 -0.008332 0.02186 -0.3811 2715 0.7031 -0.05118 0.03451
fixed NA sibling_count5 0.00707 0.02522 0.2804 2382 0.7792 -0.04235 0.05649
fixed NA sibling_count>5 0.01936 0.02141 0.9043 2398 0.3659 -0.02261 0.06133
ran_pars mother_pidlink sd__(Intercept) 0.1663 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3423 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1905 0.2526 0.7539 3593 0.4509 -0.3047 0.6856
fixed NA birth_order 0.003283 0.004052 0.81 3583 0.418 -0.00466 0.01123
fixed NA poly(age, 3, raw = TRUE)1 -0.005701 0.02715 -0.21 3589 0.8337 -0.05891 0.04751
fixed NA poly(age, 3, raw = TRUE)2 0.0001888 0.0009304 0.2029 3584 0.8392 -0.001635 0.002012
fixed NA poly(age, 3, raw = TRUE)3 -0.000001065 0.00001021 -0.1043 3581 0.9169 -0.00002107 0.00001894
fixed NA male 0.01743 0.01271 1.372 3540 0.1701 -0.007468 0.04234
fixed NA sibling_count3 -0.007723 0.02091 -0.3694 2886 0.7119 -0.04871 0.03326
fixed NA sibling_count4 -0.01195 0.02231 -0.5356 2727 0.5922 -0.05569 0.03178
fixed NA sibling_count5 0.00124 0.02622 0.04729 2426 0.9623 -0.05016 0.05264
fixed NA sibling_count>5 0.007432 0.02599 0.2859 2621 0.7749 -0.04351 0.05837
ran_pars mother_pidlink sd__(Intercept) 0.1663 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3424 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1896 0.2527 0.7506 3589 0.453 -0.3056 0.6848
fixed NA poly(age, 3, raw = TRUE)1 -0.006112 0.02713 -0.2253 3584 0.8218 -0.05929 0.04707
fixed NA poly(age, 3, raw = TRUE)2 0.0001968 0.0009299 0.2116 3579 0.8324 -0.001626 0.002019
fixed NA poly(age, 3, raw = TRUE)3 -0.000001088 0.0000102 -0.1067 3576 0.9151 -0.00002109 0.00001891
fixed NA male 0.01806 0.0127 1.422 3538 0.1551 -0.006835 0.04296
fixed NA sibling_count3 -0.01698 0.02128 -0.7977 2977 0.4251 -0.05869 0.02473
fixed NA sibling_count4 -0.0222 0.02304 -0.9634 2889 0.3354 -0.06736 0.02296
fixed NA sibling_count5 -0.001415 0.0272 -0.052 2640 0.9585 -0.05473 0.0519
fixed NA sibling_count>5 0.001559 0.02661 0.0586 2758 0.9533 -0.0506 0.05372
fixed NA birth_order_nonlinear2 0.03129 0.0164 1.908 3101 0.05647 -0.000851 0.06344
fixed NA birth_order_nonlinear3 0.04782 0.01938 2.467 3148 0.01367 0.00983 0.0858
fixed NA birth_order_nonlinear4 0.02218 0.02437 0.9103 3189 0.3627 -0.02557 0.06994
fixed NA birth_order_nonlinear5 -0.006486 0.03001 -0.2161 3153 0.8289 -0.06531 0.05234
fixed NA birth_order_nonlinear>5 0.04426 0.02993 1.479 3584 0.1393 -0.0144 0.1029
ran_pars mother_pidlink sd__(Intercept) 0.1653 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3425 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1681 0.2535 0.663 3581 0.5074 -0.3288 0.665
fixed NA poly(age, 3, raw = TRUE)1 -0.003336 0.02724 -0.1225 3577 0.9025 -0.05672 0.05005
fixed NA poly(age, 3, raw = TRUE)2 0.0000858 0.0009339 0.09188 3574 0.9268 -0.001745 0.001916
fixed NA poly(age, 3, raw = TRUE)3 0.0000002996 0.00001025 0.02923 3572 0.9767 -0.00001979 0.00002039
fixed NA male 0.01896 0.01272 1.49 3530 0.1362 -0.005974 0.04389
fixed NA count_birth_order2/2 0.02905 0.03134 0.9271 3202 0.354 -0.03237 0.09047
fixed NA count_birth_order1/3 -0.002032 0.02696 -0.07537 3564 0.9399 -0.05487 0.05081
fixed NA count_birth_order2/3 -0.007826 0.02992 -0.2615 3584 0.7937 -0.06648 0.05082
fixed NA count_birth_order3/3 0.02743 0.03219 0.8522 3585 0.3942 -0.03565 0.09051
fixed NA count_birth_order1/4 -0.02844 0.03159 -0.9001 3582 0.3681 -0.09036 0.03349
fixed NA count_birth_order2/4 0.01055 0.03314 0.3183 3586 0.7503 -0.0544 0.07549
fixed NA count_birth_order3/4 0.05262 0.03435 1.532 3581 0.1257 -0.01471 0.12
fixed NA count_birth_order4/4 -0.02922 0.0373 -0.7834 3574 0.4334 -0.1023 0.04389
fixed NA count_birth_order1/5 -0.005244 0.04125 -0.1271 3586 0.8989 -0.0861 0.07561
fixed NA count_birth_order2/5 0.01438 0.04592 0.3131 3554 0.7542 -0.07563 0.1044
fixed NA count_birth_order3/5 0.03522 0.04477 0.7867 3553 0.4315 -0.05253 0.123
fixed NA count_birth_order4/5 0.06448 0.04311 1.496 3558 0.1348 -0.02001 0.149
fixed NA count_birth_order5/5 -0.02928 0.04577 -0.6397 3549 0.5224 -0.119 0.06042
fixed NA count_birth_order1/>5 -0.03966 0.04016 -0.9875 3576 0.3235 -0.1184 0.03906
fixed NA count_birth_order2/>5 0.09011 0.04053 2.224 3547 0.02624 0.01068 0.1695
fixed NA count_birth_order3/>5 0.02288 0.0387 0.5913 3555 0.5544 -0.05297 0.09873
fixed NA count_birth_order4/>5 0.02081 0.03882 0.5362 3528 0.5919 -0.05527 0.09689
fixed NA count_birth_order5/>5 0.005412 0.03647 0.1484 3550 0.882 -0.06607 0.07689
fixed NA count_birth_order>5/>5 0.04579 0.02876 1.592 3444 0.1114 -0.01057 0.1022
ran_pars mother_pidlink sd__(Intercept) 0.1631 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3434 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 3231 3300 -1605 3209 NA NA NA
12 3233 3307 -1604 3209 0.6582 1 0.4172
16 3232 3331 -1600 3200 8.947 4 0.06245
26 3241 3402 -1595 3189 10.51 10 0.3971

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Sector_Construction

birthorder <- birthorder %>% mutate(outcome = `Sector_Construction`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
## boundary (singular) fit: see ?isSingular
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.00014 0.007992 -0.01751 9745 0.986 -0.0158 0.01552
fixed NA poly(age, 3, raw = TRUE)1 0.0001646 0.0007143 0.2304 9745 0.8178 -0.001235 0.001565
fixed NA poly(age, 3, raw = TRUE)2 -0.000005987 0.00001998 -0.2997 9745 0.7644 -0.00004514 0.00003317
fixed NA poly(age, 3, raw = TRUE)3 0.00000005958 0.0000001767 0.3371 9745 0.736 -0.0000002868 0.000000406
fixed NA male 0.001437 0.0007496 1.917 9745 0.05521 -0.00003186 0.002907
fixed NA sibling_count3 -0.001779 0.001507 -1.18 9745 0.2379 -0.004733 0.001175
fixed NA sibling_count4 0.0006745 0.001514 0.4455 9745 0.656 -0.002293 0.003642
fixed NA sibling_count5 -0.0008865 0.001566 -0.5663 9745 0.5712 -0.003955 0.002182
fixed NA sibling_count>5 -0.0004652 0.001227 -0.3793 9745 0.7045 -0.002869 0.001939
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03649 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.0001227 0.007992 -0.01535 9744 0.9878 -0.01579 0.01554
fixed NA birth_order 0.00008633 0.0001468 0.5883 9744 0.5564 -0.0002013 0.000374
fixed NA poly(age, 3, raw = TRUE)1 0.0001414 0.0007155 0.1976 9744 0.8433 -0.001261 0.001544
fixed NA poly(age, 3, raw = TRUE)2 -0.00000519 0.00002002 -0.2592 9744 0.7955 -0.00004443 0.00003405
fixed NA poly(age, 3, raw = TRUE)3 0.00000005258 0.0000001771 0.2968 9744 0.7666 -0.0000002946 0.0000003998
fixed NA male 0.001435 0.0007497 1.914 9744 0.05564 -0.00003438 0.002904
fixed NA sibling_count3 -0.001804 0.001508 -1.197 9744 0.2315 -0.00476 0.001151
fixed NA sibling_count4 0.000616 0.001517 0.4059 9744 0.6848 -0.002358 0.00359
fixed NA sibling_count5 -0.0009842 0.001574 -0.6252 9744 0.5319 -0.00407 0.002101
fixed NA sibling_count>5 -0.0007791 0.001338 -0.5825 9744 0.5603 -0.003401 0.001843
ran_pars mother_pidlink sd__(Intercept) 0.000000003213 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03649 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.0006085 0.008007 -0.07599 9740 0.9394 -0.0163 0.01508
fixed NA poly(age, 3, raw = TRUE)1 0.0002089 0.0007162 0.2916 9740 0.7706 -0.001195 0.001613
fixed NA poly(age, 3, raw = TRUE)2 -0.000007051 0.00002004 -0.3519 9740 0.7249 -0.00004633 0.00003222
fixed NA poly(age, 3, raw = TRUE)3 0.00000006636 0.0000001772 0.3744 9740 0.7081 -0.000000281 0.0000004138
fixed NA male 0.00143 0.0007498 1.907 9740 0.05657 -0.00003985 0.002899
fixed NA sibling_count3 -0.001577 0.001534 -1.028 9740 0.3039 -0.004583 0.001429
fixed NA sibling_count4 0.001223 0.001566 0.7812 9740 0.4347 -0.001846 0.004293
fixed NA sibling_count5 -0.0005539 0.001638 -0.3382 9740 0.7352 -0.003764 0.002656
fixed NA sibling_count>5 -0.00006166 0.00141 -0.04372 9740 0.9651 -0.002826 0.002702
fixed NA birth_order_nonlinear2 -0.00004771 0.001109 -0.04303 9740 0.9657 -0.002221 0.002126
fixed NA birth_order_nonlinear3 -0.0008901 0.001289 -0.6904 9740 0.4899 -0.003417 0.001637
fixed NA birth_order_nonlinear4 -0.002 0.001448 -1.382 9740 0.1671 -0.004838 0.0008371
fixed NA birth_order_nonlinear5 0.000813 0.001625 0.5004 9740 0.6168 -0.002372 0.003998
fixed NA birth_order_nonlinear>5 -0.0004879 0.001322 -0.369 9740 0.7121 -0.003079 0.002104
ran_pars mother_pidlink sd__(Intercept) 0.000000004815 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03649 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.001129 0.00804 -0.1404 9730 0.8883 -0.01689 0.01463
fixed NA poly(age, 3, raw = TRUE)1 0.0002277 0.0007171 0.3175 9730 0.7509 -0.001178 0.001633
fixed NA poly(age, 3, raw = TRUE)2 -0.000007642 0.00002005 -0.3811 9730 0.7032 -0.00004695 0.00003166
fixed NA poly(age, 3, raw = TRUE)3 0.00000007203 0.0000001773 0.4062 9730 0.6846 -0.0000002756 0.0000004196
fixed NA male 0.001399 0.0007502 1.865 9730 0.06222 -0.00007127 0.00287
fixed NA count_birth_order2/2 0.0008908 0.002215 0.4021 9730 0.6876 -0.003451 0.005233
fixed NA count_birth_order1/3 -0.001422 0.002092 -0.6798 9730 0.4966 -0.005522 0.002678
fixed NA count_birth_order2/3 -0.001456 0.002328 -0.6254 9730 0.5317 -0.006017 0.003106
fixed NA count_birth_order3/3 -0.001499 0.002556 -0.5867 9730 0.5574 -0.006508 0.003509
fixed NA count_birth_order1/4 0.003658 0.002303 1.588 9730 0.1122 -0.0008556 0.008173
fixed NA count_birth_order2/4 0.001647 0.00247 0.6669 9730 0.5048 -0.003194 0.006489
fixed NA count_birth_order3/4 -0.001469 0.002605 -0.5637 9730 0.573 -0.006575 0.003638
fixed NA count_birth_order4/4 -0.001533 0.002805 -0.5465 9730 0.5847 -0.00703 0.003965
fixed NA count_birth_order1/5 -0.001484 0.002599 -0.5709 9730 0.5681 -0.006577 0.00361
fixed NA count_birth_order2/5 0.00277 0.002759 1.004 9730 0.3154 -0.002637 0.008178
fixed NA count_birth_order3/5 -0.001468 0.002903 -0.5055 9730 0.6132 -0.007158 0.004222
fixed NA count_birth_order4/5 -0.001597 0.003066 -0.521 9730 0.6023 -0.007606 0.004411
fixed NA count_birth_order5/5 -0.001528 0.00307 -0.4976 9730 0.6188 -0.007545 0.00449
fixed NA count_birth_order1/>5 0.0001466 0.00201 0.07294 9730 0.9419 -0.003793 0.004087
fixed NA count_birth_order2/>5 -0.001418 0.00209 -0.6783 9730 0.4976 -0.005515 0.002679
fixed NA count_birth_order3/>5 0.0002647 0.002069 0.1279 9730 0.8982 -0.003791 0.00432
fixed NA count_birth_order4/>5 -0.001477 0.002027 -0.729 9730 0.466 -0.00545 0.002495
fixed NA count_birth_order5/>5 0.001744 0.002049 0.8512 9730 0.3947 -0.002272 0.00576
fixed NA count_birth_order>5/>5 -0.0001939 0.001632 -0.1188 9730 0.9054 -0.003393 0.003005
ran_pars mother_pidlink sd__(Intercept) 0.000000002354 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03649 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -36894 -36815 18458 -36916 NA NA NA
12 -36892 -36806 18458 -36916 0.3464 1 0.5562
16 -36887 -36772 18460 -36919 3.056 4 0.5484
26 -36874 -36687 18463 -36926 7.077 10 0.7181

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01904 0.02438 -0.7808 3665 0.4349 -0.06683 0.02875
fixed NA poly(age, 3, raw = TRUE)1 0.00222 0.002615 0.8488 3665 0.3961 -0.002906 0.007345
fixed NA poly(age, 3, raw = TRUE)2 -0.00006986 0.00008957 -0.7799 3665 0.4355 -0.0002454 0.0001057
fixed NA poly(age, 3, raw = TRUE)3 0.0000006769 0.0000009816 0.6896 3665 0.4905 -0.000001247 0.000002601
fixed NA male 0.001275 0.001234 1.033 3665 0.3016 -0.001144 0.003695
fixed NA sibling_count3 -0.002135 0.001996 -1.07 3665 0.2848 -0.006047 0.001777
fixed NA sibling_count4 -0.003247 0.002052 -1.582 3665 0.1136 -0.007268 0.0007746
fixed NA sibling_count5 -0.001205 0.002273 -0.5304 3665 0.5958 -0.00566 0.003249
fixed NA sibling_count>5 -0.002255 0.00196 -1.15 3665 0.2501 -0.006098 0.001587
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03688 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01893 0.02439 -0.7762 3664 0.4377 -0.06673 0.02887
fixed NA birth_order 0.0001139 0.0003773 0.302 3664 0.7627 -0.0006255 0.0008534
fixed NA poly(age, 3, raw = TRUE)1 0.002195 0.002617 0.839 3664 0.4015 -0.002933 0.007324
fixed NA poly(age, 3, raw = TRUE)2 -0.00006929 0.0000896 -0.7733 3664 0.4394 -0.0002449 0.0001063
fixed NA poly(age, 3, raw = TRUE)3 0.0000006754 0.0000009817 0.688 3664 0.4915 -0.000001249 0.000002599
fixed NA male 0.001271 0.001235 1.029 3664 0.3035 -0.001149 0.00369
fixed NA sibling_count3 -0.002192 0.002005 -1.093 3664 0.2744 -0.006121 0.001738
fixed NA sibling_count4 -0.00337 0.002092 -1.611 3664 0.1073 -0.007472 0.0007308
fixed NA sibling_count5 -0.001409 0.002371 -0.5944 3664 0.5523 -0.006056 0.003238
fixed NA sibling_count>5 -0.00266 0.002374 -1.12 3664 0.2627 -0.007313 0.001994
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03689 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01804 0.0244 -0.7394 3660 0.4597 -0.06587 0.02979
fixed NA poly(age, 3, raw = TRUE)1 0.002198 0.002617 0.8399 3660 0.401 -0.002931 0.007327
fixed NA poly(age, 3, raw = TRUE)2 -0.00006814 0.00008961 -0.7603 3660 0.4471 -0.0002438 0.0001075
fixed NA poly(age, 3, raw = TRUE)3 0.0000006483 0.0000009821 0.6601 3660 0.5092 -0.000001276 0.000002573
fixed NA male 0.001222 0.001235 0.9901 3660 0.3222 -0.001198 0.003642
fixed NA sibling_count3 -0.001531 0.002047 -0.7481 3660 0.4545 -0.005542 0.00248
fixed NA sibling_count4 -0.002233 0.002175 -1.027 3660 0.3047 -0.006497 0.00203
fixed NA sibling_count5 0.0001622 0.002493 0.06504 3660 0.9481 -0.004725 0.005049
fixed NA sibling_count>5 -0.001611 0.002443 -0.6594 3660 0.5097 -0.0064 0.003178
fixed NA birth_order_nonlinear2 -0.003122 0.001656 -1.886 3660 0.05944 -0.006368 0.0001233
fixed NA birth_order_nonlinear3 -0.002794 0.00194 -1.44 3660 0.15 -0.006597 0.001009
fixed NA birth_order_nonlinear4 -0.003035 0.002365 -1.284 3660 0.1994 -0.00767 0.0016
fixed NA birth_order_nonlinear5 -0.003377 0.002899 -1.165 3660 0.2441 -0.009059 0.002304
fixed NA birth_order_nonlinear>5 -0.0000936 0.002817 -0.03323 3660 0.9735 -0.005614 0.005427
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03688 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01888 0.02451 -0.7703 3650 0.4412 -0.06692 0.02916
fixed NA poly(age, 3, raw = TRUE)1 0.002348 0.002629 0.8932 3650 0.3718 -0.002804 0.0075
fixed NA poly(age, 3, raw = TRUE)2 -0.00007276 0.00009004 -0.8081 3650 0.4191 -0.0002492 0.0001037
fixed NA poly(age, 3, raw = TRUE)3 0.0000006932 0.0000009869 0.7024 3650 0.4825 -0.000001241 0.000002627
fixed NA male 0.001217 0.001237 0.9839 3650 0.3252 -0.001208 0.003642
fixed NA count_birth_order2/2 -0.005185 0.003234 -1.603 3650 0.1089 -0.01152 0.001153
fixed NA count_birth_order1/3 -0.002396 0.002674 -0.8963 3650 0.3702 -0.007636 0.002844
fixed NA count_birth_order2/3 -0.005014 0.002973 -1.687 3650 0.09177 -0.01084 0.0008128
fixed NA count_birth_order3/3 -0.005052 0.00324 -1.559 3650 0.119 -0.0114 0.001299
fixed NA count_birth_order1/4 -0.004789 0.003067 -1.561 3650 0.1185 -0.0108 0.001222
fixed NA count_birth_order2/4 -0.004976 0.003253 -1.529 3650 0.1262 -0.01135 0.0014
fixed NA count_birth_order3/4 -0.004932 0.003375 -1.461 3650 0.144 -0.01155 0.001683
fixed NA count_birth_order4/4 -0.005233 0.003613 -1.448 3650 0.1476 -0.01231 0.001848
fixed NA count_birth_order1/5 0.004607 0.004041 1.14 3650 0.2544 -0.003313 0.01253
fixed NA count_birth_order2/5 -0.004763 0.004362 -1.092 3650 0.2749 -0.01331 0.003786
fixed NA count_birth_order3/5 -0.004893 0.004147 -1.18 3650 0.2381 -0.01302 0.003235
fixed NA count_birth_order4/5 -0.005202 0.004046 -1.286 3650 0.1987 -0.01313 0.002729
fixed NA count_birth_order5/5 -0.005179 0.004259 -1.216 3650 0.2241 -0.01353 0.003169
fixed NA count_birth_order1/>5 -0.004681 0.003823 -1.224 3650 0.2209 -0.01217 0.002812
fixed NA count_birth_order2/>5 -0.00473 0.003857 -1.226 3650 0.2201 -0.01229 0.002829
fixed NA count_birth_order3/>5 -0.004821 0.003765 -1.28 3650 0.2006 -0.0122 0.00256
fixed NA count_birth_order4/>5 -0.004809 0.003688 -1.304 3650 0.1923 -0.01204 0.002419
fixed NA count_birth_order5/>5 -0.004901 0.003524 -1.391 3650 0.1644 -0.01181 0.002007
fixed NA count_birth_order>5/>5 -0.002395 0.002722 -0.8798 3650 0.379 -0.007729 0.00294
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03691 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -13809 -13741 6916 -13831 NA NA NA
12 -13807 -13733 6916 -13831 0.09146 1 0.7623
16 -13805 -13705 6918 -13837 5.574 4 0.2333
26 -13790 -13628 6921 -13842 4.71 10 0.9097

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01904 0.02419 -0.7868 3689 0.4314 -0.06646 0.02838
fixed NA poly(age, 3, raw = TRUE)1 0.002273 0.002597 0.875 3689 0.3816 -0.002818 0.007363
fixed NA poly(age, 3, raw = TRUE)2 -0.00007096 0.00008898 -0.7975 3689 0.4252 -0.0002454 0.0001034
fixed NA poly(age, 3, raw = TRUE)3 0.0000006852 0.0000009753 0.7025 3689 0.4824 -0.000001226 0.000002597
fixed NA male 0.001309 0.001226 1.067 3689 0.2859 -0.001094 0.003712
fixed NA sibling_count3 -0.002695 0.002183 -1.235 3689 0.217 -0.006973 0.001583
fixed NA sibling_count4 -0.004092 0.002196 -1.864 3689 0.0624 -0.008396 0.0002107
fixed NA sibling_count5 -0.002261 0.002303 -0.9815 3689 0.3264 -0.006775 0.002254
fixed NA sibling_count>5 -0.00326 0.00202 -1.614 3689 0.1067 -0.00722 0.0006995
ran_pars mother_pidlink sd__(Intercept) 0.000000000423 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03676 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01896 0.0242 -0.7833 3688 0.4335 -0.06639 0.02847
fixed NA birth_order 0.0001029 0.0003309 0.3109 3688 0.7559 -0.0005457 0.0007515
fixed NA poly(age, 3, raw = TRUE)1 0.002253 0.002598 0.8669 3688 0.386 -0.00284 0.007346
fixed NA poly(age, 3, raw = TRUE)2 -0.00007051 0.000089 -0.7923 3688 0.4282 -0.000245 0.0001039
fixed NA poly(age, 3, raw = TRUE)3 0.0000006846 0.0000009754 0.7018 3688 0.4828 -0.000001227 0.000002596
fixed NA male 0.001304 0.001226 1.064 3688 0.2876 -0.001099 0.003708
fixed NA sibling_count3 -0.002747 0.002189 -1.255 3688 0.2097 -0.007037 0.001544
fixed NA sibling_count4 -0.004195 0.00222 -1.889 3688 0.05893 -0.008547 0.0001569
fixed NA sibling_count5 -0.002432 0.002369 -1.027 3688 0.3046 -0.007075 0.00221
fixed NA sibling_count>5 -0.003621 0.00233 -1.554 3688 0.1202 -0.008187 0.0009452
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03676 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01787 0.02422 -0.7379 3684 0.4606 -0.06533 0.02959
fixed NA poly(age, 3, raw = TRUE)1 0.002244 0.002599 0.8634 3684 0.388 -0.00285 0.007338
fixed NA poly(age, 3, raw = TRUE)2 -0.00006906 0.00008903 -0.7757 3684 0.438 -0.0002435 0.0001054
fixed NA poly(age, 3, raw = TRUE)3 0.0000006551 0.0000009758 0.6713 3684 0.5021 -0.000001258 0.000002568
fixed NA male 0.001255 0.001226 1.023 3684 0.3063 -0.001149 0.003658
fixed NA sibling_count3 -0.002103 0.002228 -0.944 3684 0.3452 -0.006471 0.002264
fixed NA sibling_count4 -0.003207 0.00229 -1.4 3684 0.1615 -0.007695 0.001281
fixed NA sibling_count5 -0.001055 0.002481 -0.4253 3684 0.6706 -0.005918 0.003807
fixed NA sibling_count>5 -0.002713 0.002404 -1.129 3684 0.2591 -0.007424 0.001998
fixed NA birth_order_nonlinear2 -0.003291 0.001669 -1.972 3684 0.04873 -0.006562 -0.00001936
fixed NA birth_order_nonlinear3 -0.002759 0.001942 -1.42 3684 0.1556 -0.006566 0.001048
fixed NA birth_order_nonlinear4 -0.002861 0.002297 -1.245 3684 0.213 -0.007363 0.001641
fixed NA birth_order_nonlinear5 -0.003159 0.002798 -1.129 3684 0.2588 -0.008642 0.002324
fixed NA birth_order_nonlinear>5 -0.00035 0.002537 -0.1379 3684 0.8903 -0.005323 0.004623
ran_pars mother_pidlink sd__(Intercept) 0.0000000005529 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03675 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01698 0.02429 -0.6991 3674 0.4845 -0.0646 0.03063
fixed NA poly(age, 3, raw = TRUE)1 0.00227 0.002608 0.8703 3674 0.3842 -0.002841 0.007381
fixed NA poly(age, 3, raw = TRUE)2 -0.0000702 0.00008935 -0.7857 3674 0.4321 -0.0002453 0.0001049
fixed NA poly(age, 3, raw = TRUE)3 0.0000006703 0.0000009796 0.6843 3674 0.4939 -0.00000125 0.00000259
fixed NA male 0.001227 0.001229 0.9981 3674 0.3183 -0.001183 0.003637
fixed NA count_birth_order2/2 -0.006385 0.00353 -1.809 3674 0.07059 -0.0133 0.0005343
fixed NA count_birth_order1/3 -0.003068 0.002946 -1.041 3674 0.2979 -0.008843 0.002707
fixed NA count_birth_order2/3 -0.006267 0.00321 -1.952 3674 0.051 -0.01256 0.0000252
fixed NA count_birth_order3/3 -0.006277 0.003561 -1.763 3674 0.07802 -0.01326 0.0007021
fixed NA count_birth_order1/4 -0.006116 0.003198 -1.913 3674 0.05587 -0.01238 0.0001512
fixed NA count_birth_order2/4 -0.006265 0.003371 -1.859 3674 0.06317 -0.01287 0.0003419
fixed NA count_birth_order3/4 -0.006214 0.003651 -1.702 3674 0.08881 -0.01337 0.0009411
fixed NA count_birth_order4/4 -0.006527 0.003966 -1.646 3674 0.09987 -0.0143 0.001246
fixed NA count_birth_order1/5 0.001582 0.003866 0.4093 3674 0.6824 -0.005996 0.00916
fixed NA count_birth_order2/5 -0.006089 0.003966 -1.535 3674 0.1248 -0.01386 0.001684
fixed NA count_birth_order3/5 -0.006068 0.004082 -1.486 3674 0.1372 -0.01407 0.001933
fixed NA count_birth_order4/5 -0.006315 0.004157 -1.519 3674 0.1288 -0.01446 0.001832
fixed NA count_birth_order5/5 -0.006395 0.004222 -1.515 3674 0.1299 -0.01467 0.001879
fixed NA count_birth_order1/>5 -0.00598 0.003485 -1.716 3674 0.08623 -0.01281 0.0008499
fixed NA count_birth_order2/>5 -0.006117 0.003686 -1.66 3674 0.09705 -0.01334 0.001106
fixed NA count_birth_order3/>5 -0.006069 0.003552 -1.709 3674 0.08763 -0.01303 0.0008932
fixed NA count_birth_order4/>5 -0.006211 0.003452 -1.799 3674 0.07209 -0.01298 0.0005554
fixed NA count_birth_order5/>5 -0.006157 0.003658 -1.683 3674 0.09237 -0.01333 0.001011
fixed NA count_birth_order>5/>5 -0.004098 0.002734 -1.499 3674 0.134 -0.009457 0.00126
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03678 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -13925 -13856 6973 -13947 NA NA NA
12 -13923 -13848 6973 -13947 0.09692 1 0.7556
16 -13920 -13821 6976 -13952 5.536 4 0.2366
26 -13904 -13743 6978 -13956 4.304 10 0.9326

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.02014 0.02484 -0.8108 3601 0.4176 -0.06881 0.02854
fixed NA poly(age, 3, raw = TRUE)1 0.002324 0.002668 0.871 3601 0.3838 -0.002905 0.007553
fixed NA poly(age, 3, raw = TRUE)2 -0.00007334 0.00009147 -0.8018 3601 0.4227 -0.0002526 0.0001059
fixed NA poly(age, 3, raw = TRUE)3 0.0000007122 0.000001003 0.7098 3601 0.4779 -0.000001255 0.000002679
fixed NA male 0.001306 0.001257 1.039 3601 0.2987 -0.001157 0.003769
fixed NA sibling_count3 -0.002062 0.001971 -1.046 3601 0.2955 -0.005924 0.0018
fixed NA sibling_count4 -0.003122 0.002055 -1.52 3601 0.1287 -0.00715 0.000905
fixed NA sibling_count5 -0.0008557 0.002335 -0.3665 3601 0.714 -0.005432 0.003721
fixed NA sibling_count>5 -0.002037 0.001982 -1.028 3601 0.3042 -0.005921 0.001848
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03721 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01997 0.02484 -0.804 3600 0.4215 -0.06867 0.02872
fixed NA birth_order 0.0001248 0.0003922 0.3183 3600 0.7503 -0.0006439 0.0008935
fixed NA poly(age, 3, raw = TRUE)1 0.002292 0.00267 0.8585 3600 0.3907 -0.002941 0.007526
fixed NA poly(age, 3, raw = TRUE)2 -0.00007255 0.00009151 -0.7927 3600 0.428 -0.0002519 0.0001068
fixed NA poly(age, 3, raw = TRUE)3 0.0000007088 0.000001004 0.7062 3600 0.4801 -0.000001258 0.000002676
fixed NA male 0.001304 0.001257 1.038 3600 0.2994 -0.001159 0.003767
fixed NA sibling_count3 -0.002125 0.001981 -1.073 3600 0.2834 -0.006007 0.001757
fixed NA sibling_count4 -0.003256 0.002098 -1.552 3600 0.1207 -0.007368 0.0008552
fixed NA sibling_count5 -0.001071 0.002431 -0.4406 3600 0.6596 -0.005836 0.003694
fixed NA sibling_count>5 -0.00248 0.002422 -1.024 3600 0.3061 -0.007228 0.002268
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03721 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01926 0.02486 -0.7748 3596 0.4385 -0.06798 0.02946
fixed NA poly(age, 3, raw = TRUE)1 0.002317 0.00267 0.8677 3596 0.3856 -0.002916 0.007551
fixed NA poly(age, 3, raw = TRUE)2 -0.00007222 0.00009152 -0.7891 3596 0.4301 -0.0002516 0.0001072
fixed NA poly(age, 3, raw = TRUE)3 0.000000692 0.000001004 0.6892 3596 0.4907 -0.000001276 0.00000266
fixed NA male 0.001266 0.001257 1.008 3596 0.3137 -0.001197 0.00373
fixed NA sibling_count3 -0.00148 0.002025 -0.7309 3596 0.4649 -0.005448 0.002488
fixed NA sibling_count4 -0.002126 0.002182 -0.9744 3596 0.3299 -0.006403 0.002151
fixed NA sibling_count5 0.0004233 0.002547 0.1662 3596 0.868 -0.004569 0.005415
fixed NA sibling_count>5 -0.001472 0.002497 -0.5893 3596 0.5557 -0.006366 0.003423
fixed NA birth_order_nonlinear2 -0.003103 0.001663 -1.866 3596 0.06216 -0.006363 0.0001568
fixed NA birth_order_nonlinear3 -0.002762 0.00196 -1.409 3596 0.1589 -0.006603 0.00108
fixed NA birth_order_nonlinear4 -0.003046 0.002457 -1.239 3596 0.2152 -0.007861 0.00177
fixed NA birth_order_nonlinear5 -0.003403 0.003029 -1.123 3596 0.2613 -0.009339 0.002533
fixed NA birth_order_nonlinear>5 0.00008479 0.002932 0.02891 3596 0.9769 -0.005663 0.005832
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03721 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01999 0.02495 -0.8009 3586 0.4232 -0.0689 0.02892
fixed NA poly(age, 3, raw = TRUE)1 0.002455 0.002681 0.9155 3586 0.36 -0.0028 0.00771
fixed NA poly(age, 3, raw = TRUE)2 -0.00007656 0.00009193 -0.8328 3586 0.405 -0.0002567 0.0001036
fixed NA poly(age, 3, raw = TRUE)3 0.0000007349 0.000001009 0.7286 3586 0.4663 -0.000001242 0.000002712
fixed NA male 0.00125 0.001259 0.9929 3586 0.3208 -0.001218 0.003719
fixed NA count_birth_order2/2 -0.004988 0.003173 -1.572 3586 0.116 -0.01121 0.001231
fixed NA count_birth_order1/3 -0.002318 0.002649 -0.8749 3586 0.3817 -0.00751 0.002875
fixed NA count_birth_order2/3 -0.00488 0.002948 -1.655 3586 0.09796 -0.01066 0.0008983
fixed NA count_birth_order3/3 -0.004906 0.003177 -1.544 3586 0.1226 -0.01113 0.001321
fixed NA count_birth_order1/4 -0.004633 0.00311 -1.49 3586 0.1363 -0.01073 0.001461
fixed NA count_birth_order2/4 -0.004836 0.003269 -1.479 3586 0.1392 -0.01124 0.001571
fixed NA count_birth_order3/4 -0.004774 0.003394 -1.407 3586 0.1596 -0.01142 0.001878
fixed NA count_birth_order4/4 -0.005074 0.003687 -1.376 3586 0.1689 -0.0123 0.002153
fixed NA count_birth_order1/5 0.00475 0.004066 1.168 3586 0.2427 -0.003218 0.01272
fixed NA count_birth_order2/5 -0.004579 0.004544 -1.008 3586 0.3136 -0.01349 0.004327
fixed NA count_birth_order3/5 -0.004708 0.004432 -1.062 3586 0.2882 -0.0134 0.003979
fixed NA count_birth_order4/5 -0.005011 0.004267 -1.174 3586 0.2403 -0.01337 0.003352
fixed NA count_birth_order5/5 -0.005039 0.004533 -1.111 3586 0.2665 -0.01392 0.003847
fixed NA count_birth_order1/>5 -0.004509 0.003959 -1.139 3586 0.2548 -0.01227 0.003251
fixed NA count_birth_order2/>5 -0.004502 0.004007 -1.124 3586 0.2613 -0.01236 0.003352
fixed NA count_birth_order3/>5 -0.00464 0.003827 -1.212 3586 0.2255 -0.01214 0.002862
fixed NA count_birth_order4/>5 -0.00463 0.003846 -1.204 3586 0.2287 -0.01217 0.002908
fixed NA count_birth_order5/>5 -0.00472 0.003611 -1.307 3586 0.1912 -0.0118 0.002357
fixed NA count_birth_order>5/>5 -0.002027 0.002777 -0.7299 3586 0.4655 -0.007471 0.003416
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.03723 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -13505 -13437 6763 -13527 NA NA NA
12 -13503 -13429 6763 -13527 0.1016 1 0.75
16 -13500 -13401 6766 -13532 5.511 4 0.2388
26 -13485 -13324 6768 -13537 4.409 10 0.927

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Sector_Electricity, gas, water

birthorder <- birthorder %>% mutate(outcome = `Sector_Electricity, gas, water`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01323 0.0289 0.4577 9429 0.6472 -0.04342 0.06987
fixed NA poly(age, 3, raw = TRUE)1 0.0002009 0.002584 0.07776 9336 0.938 -0.004864 0.005266
fixed NA poly(age, 3, raw = TRUE)2 0.00001341 0.0000723 0.1854 9207 0.8529 -0.0001283 0.0001551
fixed NA poly(age, 3, raw = TRUE)3 -0.0000002622 0.0000006399 -0.4098 9080 0.682 -0.000001516 0.0000009919
fixed NA male 0.00005814 0.002704 0.02151 9745 0.9828 -0.005241 0.005357
fixed NA sibling_count3 -0.006514 0.005475 -1.19 7729 0.2342 -0.01724 0.004217
fixed NA sibling_count4 0.000643 0.005507 0.1168 7189 0.9071 -0.01015 0.01144
fixed NA sibling_count5 -0.01138 0.005702 -1.996 6635 0.04598 -0.02256 -0.000205
fixed NA sibling_count>5 -0.007491 0.004458 -1.68 7477 0.09295 -0.01623 0.001247
ran_pars mother_pidlink sd__(Intercept) 0.02111 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1299 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01323 0.0289 0.4578 9428 0.6471 -0.04341 0.06988
fixed NA birth_order 0.00004661 0.0005342 0.08725 7243 0.9305 -0.001 0.001094
fixed NA poly(age, 3, raw = TRUE)1 0.0001884 0.002588 0.07278 9324 0.942 -0.004885 0.005262
fixed NA poly(age, 3, raw = TRUE)2 0.00001385 0.00007248 0.191 9168 0.8485 -0.0001282 0.0001559
fixed NA poly(age, 3, raw = TRUE)3 -0.0000002661 0.0000006415 -0.4149 9029 0.6783 -0.000001523 0.0000009911
fixed NA male 0.00005681 0.002704 0.02101 9744 0.9832 -0.005243 0.005356
fixed NA sibling_count3 -0.006527 0.005477 -1.192 7738 0.2334 -0.01726 0.004208
fixed NA sibling_count4 0.000612 0.005519 0.1109 7229 0.9117 -0.01021 0.01143
fixed NA sibling_count5 -0.01143 0.005733 -1.994 6708 0.04618 -0.02267 -0.0001956
fixed NA sibling_count>5 -0.007659 0.004856 -1.577 8054 0.1148 -0.01718 0.001858
ran_pars mother_pidlink sd__(Intercept) 0.02113 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1299 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01097 0.02895 0.3791 9435 0.7047 -0.04577 0.06772
fixed NA poly(age, 3, raw = TRUE)1 0.0002738 0.002591 0.1057 9329 0.9159 -0.004804 0.005352
fixed NA poly(age, 3, raw = TRUE)2 0.000009056 0.00007253 0.1249 9175 0.9006 -0.0001331 0.0001512
fixed NA poly(age, 3, raw = TRUE)3 -0.0000002072 0.0000006418 -0.3228 9033 0.7469 -0.000001465 0.000001051
fixed NA male 0.00005961 0.002704 0.02205 9740 0.9824 -0.00524 0.00536
fixed NA sibling_count3 -0.006954 0.005568 -1.249 7978 0.2117 -0.01787 0.003959
fixed NA sibling_count4 0.0003152 0.00569 0.0554 7705 0.9558 -0.01084 0.01147
fixed NA sibling_count5 -0.01083 0.005956 -1.819 7339 0.069 -0.0225 0.0008413
fixed NA sibling_count>5 -0.005929 0.005111 -1.16 8707 0.2461 -0.01595 0.004088
fixed NA birth_order_nonlinear2 0.006418 0.003984 1.611 9149 0.1073 -0.001391 0.01423
fixed NA birth_order_nonlinear3 0.003461 0.004631 0.7474 9088 0.4549 -0.005616 0.01254
fixed NA birth_order_nonlinear4 0.001524 0.005203 0.2928 9196 0.7696 -0.008674 0.01172
fixed NA birth_order_nonlinear5 -0.002664 0.005841 -0.456 9273 0.6484 -0.01411 0.008785
fixed NA birth_order_nonlinear>5 -0.0001668 0.004776 -0.03492 9649 0.9721 -0.009528 0.009194
ran_pars mother_pidlink sd__(Intercept) 0.02114 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1299 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.008777 0.02906 0.302 9441 0.7627 -0.04818 0.06574
fixed NA poly(age, 3, raw = TRUE)1 0.0003881 0.002593 0.1496 9319 0.8811 -0.004695 0.005471
fixed NA poly(age, 3, raw = TRUE)2 0.000006036 0.00007257 0.08317 9164 0.9337 -0.0001362 0.0001483
fixed NA poly(age, 3, raw = TRUE)3 -0.0000001841 0.0000006421 -0.2867 9020 0.7743 -0.000001443 0.000001074
fixed NA male -0.0001087 0.002705 -0.04017 9730 0.968 -0.00541 0.005193
fixed NA count_birth_order2/2 0.009253 0.00795 1.164 8855 0.2445 -0.006328 0.02483
fixed NA count_birth_order1/3 -0.002485 0.007543 -0.3295 9723 0.7418 -0.01727 0.0123
fixed NA count_birth_order2/3 -0.003798 0.008393 -0.4525 9726 0.6509 -0.02025 0.01265
fixed NA count_birth_order3/3 -0.003063 0.009215 -0.3324 9726 0.7396 -0.02113 0.015
fixed NA count_birth_order1/4 -0.006877 0.008305 -0.8281 9727 0.4076 -0.02315 0.0094
fixed NA count_birth_order2/4 0.02091 0.008908 2.347 9725 0.01892 0.003452 0.03837
fixed NA count_birth_order3/4 0.001834 0.009395 0.1952 9726 0.8452 -0.01658 0.02025
fixed NA count_birth_order4/4 0.002255 0.01012 0.2229 9725 0.8236 -0.01757 0.02208
fixed NA count_birth_order1/5 -0.005294 0.009369 -0.5651 9729 0.572 -0.02366 0.01307
fixed NA count_birth_order2/5 -0.01186 0.009948 -1.192 9729 0.2334 -0.03135 0.007642
fixed NA count_birth_order3/5 -0.01047 0.01047 -1 9729 0.3173 -0.03098 0.01005
fixed NA count_birth_order4/5 0.008094 0.01105 0.7322 9730 0.4641 -0.01357 0.02976
fixed NA count_birth_order5/5 -0.01984 0.01107 -1.793 9729 0.07308 -0.04154 0.001853
fixed NA count_birth_order1/>5 -0.003349 0.007249 -0.462 9729 0.6441 -0.01756 0.01086
fixed NA count_birth_order2/>5 -0.0008831 0.007537 -0.1172 9730 0.9067 -0.01566 0.01389
fixed NA count_birth_order3/>5 0.001765 0.007461 0.2366 9730 0.813 -0.01286 0.01639
fixed NA count_birth_order4/>5 -0.00785 0.007308 -1.074 9729 0.2827 -0.02217 0.006472
fixed NA count_birth_order5/>5 -0.005377 0.007388 -0.7278 9730 0.4667 -0.01986 0.009103
fixed NA count_birth_order>5/>5 -0.005087 0.005909 -0.861 9032 0.3893 -0.01667 0.006494
ran_pars mother_pidlink sd__(Intercept) 0.02122 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1299 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -11872 -11793 5947 -11894 NA NA NA
12 -11870 -11783 5947 -11894 0.007754 1 0.9298
16 -11866 -11751 5949 -11898 4.007 4 0.405
26 -11858 -11671 5955 -11910 12.21 10 0.271

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.06892 0.08321 -0.8282 3661 0.4076 -0.232 0.09418
fixed NA poly(age, 3, raw = TRUE)1 0.009208 0.008926 1.032 3660 0.3023 -0.008286 0.0267
fixed NA poly(age, 3, raw = TRUE)2 -0.0003094 0.0003058 -1.012 3659 0.3117 -0.0009087 0.0002899
fixed NA poly(age, 3, raw = TRUE)3 0.000003375 0.000003352 1.007 3657 0.314 -0.000003194 0.000009944
fixed NA male -0.003225 0.004207 -0.7666 3664 0.4434 -0.01147 0.00502
fixed NA sibling_count3 -0.004733 0.006873 -0.6886 3135 0.4911 -0.0182 0.008738
fixed NA sibling_count4 0.0002426 0.007083 0.03425 2921 0.9727 -0.01364 0.01413
fixed NA sibling_count5 -0.003574 0.007875 -0.4539 2600 0.65 -0.01901 0.01186
fixed NA sibling_count>5 0.000262 0.006798 0.03854 2552 0.9693 -0.01306 0.01359
ran_pars mother_pidlink sd__(Intercept) 0.02884 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1224 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.0693 0.08324 -0.8326 3659 0.4051 -0.2324 0.09384
fixed NA birth_order -0.0003813 0.001296 -0.2942 3433 0.7686 -0.002922 0.002159
fixed NA poly(age, 3, raw = TRUE)1 0.009293 0.008932 1.04 3659 0.2982 -0.008213 0.0268
fixed NA poly(age, 3, raw = TRUE)2 -0.0003114 0.0003059 -1.018 3658 0.3087 -0.000911 0.0002881
fixed NA poly(age, 3, raw = TRUE)3 0.000003381 0.000003352 1.009 3656 0.3132 -0.000003189 0.000009951
fixed NA male -0.00321 0.004208 -0.7627 3663 0.4457 -0.01146 0.005038
fixed NA sibling_count3 -0.004544 0.006904 -0.6581 3134 0.5105 -0.01808 0.008988
fixed NA sibling_count4 0.0006594 0.007225 0.09126 2915 0.9273 -0.0135 0.01482
fixed NA sibling_count5 -0.002889 0.008215 -0.3516 2625 0.7251 -0.01899 0.01321
fixed NA sibling_count>5 0.001623 0.008225 0.1974 2655 0.8435 -0.0145 0.01774
ran_pars mother_pidlink sd__(Intercept) 0.02889 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1224 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.07098 0.08333 -0.8518 3655 0.3944 -0.2343 0.09234
fixed NA poly(age, 3, raw = TRUE)1 0.00929 0.008936 1.04 3655 0.2986 -0.008224 0.02681
fixed NA poly(age, 3, raw = TRUE)2 -0.0003122 0.0003061 -1.02 3654 0.3078 -0.0009121 0.0002877
fixed NA poly(age, 3, raw = TRUE)3 0.000003395 0.000003355 1.012 3653 0.3116 -0.00000318 0.000009971
fixed NA male -0.003165 0.00421 -0.7517 3659 0.4523 -0.01142 0.005087
fixed NA sibling_count3 -0.00357 0.007046 -0.5067 3210 0.6124 -0.01738 0.01024
fixed NA sibling_count4 0.002033 0.007502 0.271 3076 0.7864 -0.01267 0.01674
fixed NA sibling_count5 -0.001211 0.00862 -0.1405 2875 0.8883 -0.01811 0.01568
fixed NA sibling_count>5 0.003208 0.008457 0.3793 2803 0.7045 -0.01337 0.01978
fixed NA birth_order_nonlinear2 0.004487 0.005605 0.8006 3363 0.4234 -0.006498 0.01547
fixed NA birth_order_nonlinear3 -0.004523 0.006574 -0.688 3425 0.4915 -0.01741 0.008361
fixed NA birth_order_nonlinear4 -0.001963 0.00802 -0.2447 3480 0.8067 -0.01768 0.01376
fixed NA birth_order_nonlinear5 -0.001521 0.009835 -0.1547 3497 0.8771 -0.0208 0.01776
fixed NA birth_order_nonlinear>5 -0.002346 0.009645 -0.2432 3610 0.8078 -0.02125 0.01656
ran_pars mother_pidlink sd__(Intercept) 0.02914 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1224 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.07149 0.08369 -0.8543 3645 0.393 -0.2355 0.09253
fixed NA poly(age, 3, raw = TRUE)1 0.009321 0.008976 1.038 3645 0.2992 -0.008272 0.02691
fixed NA poly(age, 3, raw = TRUE)2 -0.000314 0.0003075 -1.021 3644 0.3074 -0.0009167 0.0002888
fixed NA poly(age, 3, raw = TRUE)3 0.000003412 0.000003372 1.012 3642 0.3117 -0.000003197 0.00001002
fixed NA male -0.002905 0.004218 -0.6887 3649 0.4911 -0.01117 0.005363
fixed NA count_birth_order2/2 0.005885 0.01094 0.5379 3367 0.5907 -0.01556 0.02733
fixed NA count_birth_order1/3 -0.004307 0.009118 -0.4724 3648 0.6367 -0.02218 0.01356
fixed NA count_birth_order2/3 0.001187 0.01014 0.1171 3650 0.9068 -0.01868 0.02106
fixed NA count_birth_order3/3 -0.005007 0.01105 -0.4533 3650 0.6504 -0.02666 0.01664
fixed NA count_birth_order1/4 0.0067 0.01046 0.6405 3649 0.5219 -0.0138 0.0272
fixed NA count_birth_order2/4 0.005103 0.01109 0.4601 3650 0.6455 -0.01664 0.02684
fixed NA count_birth_order3/4 0.001785 0.0115 0.1551 3649 0.8767 -0.02076 0.02433
fixed NA count_birth_order4/4 -0.008181 0.01232 -0.6643 3649 0.5065 -0.03232 0.01596
fixed NA count_birth_order1/5 -0.005837 0.01378 -0.4236 3650 0.6719 -0.03285 0.02117
fixed NA count_birth_order2/5 0.01789 0.01487 1.203 3649 0.2291 -0.01126 0.04703
fixed NA count_birth_order3/5 -0.01558 0.01414 -1.102 3648 0.2705 -0.04328 0.01213
fixed NA count_birth_order4/5 -0.006235 0.01379 -0.4522 3647 0.6512 -0.03326 0.02079
fixed NA count_birth_order5/5 0.005751 0.01451 0.3963 3646 0.6919 -0.02269 0.0342
fixed NA count_birth_order1/>5 0.005701 0.01305 0.4368 3648 0.6623 -0.01988 0.03128
fixed NA count_birth_order2/>5 0.0003942 0.01316 0.02996 3650 0.9761 -0.02539 0.02618
fixed NA count_birth_order3/>5 -0.001544 0.01284 -0.1203 3649 0.9043 -0.02671 0.02362
fixed NA count_birth_order4/>5 0.01352 0.01257 1.076 3647 0.2821 -0.01112 0.03816
fixed NA count_birth_order5/>5 -0.002532 0.01201 -0.2108 3648 0.8331 -0.02608 0.02101
fixed NA count_birth_order>5/>5 0.001374 0.009344 0.147 3463 0.8831 -0.01694 0.01969
ran_pars mother_pidlink sd__(Intercept) 0.02937 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1224 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -4799 -4731 2410 -4821 NA NA NA
12 -4797 -4723 2411 -4821 0.08637 1 0.7688
16 -4791 -4692 2411 -4823 1.815 4 0.7697
26 -4777 -4615 2414 -4829 5.762 10 0.8349

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.07294 0.08327 -0.8759 3684 0.3811 -0.2362 0.09027
fixed NA poly(age, 3, raw = TRUE)1 0.009914 0.00894 1.109 3684 0.2676 -0.007609 0.02744
fixed NA poly(age, 3, raw = TRUE)2 -0.0003348 0.0003063 -1.093 3683 0.2745 -0.0009353 0.0002656
fixed NA poly(age, 3, raw = TRUE)3 0.000003659 0.000003359 1.089 3680 0.276 -0.000002924 0.00001024
fixed NA male -0.003755 0.004214 -0.8909 3688 0.373 -0.01201 0.004505
fixed NA sibling_count3 -0.005675 0.007576 -0.7491 3192 0.4538 -0.02052 0.009173
fixed NA sibling_count4 -0.005706 0.007633 -0.7476 3051 0.4548 -0.02067 0.009254
fixed NA sibling_count5 -0.00168 0.008027 -0.2093 2841 0.8342 -0.01741 0.01405
fixed NA sibling_count>5 -0.00157 0.007039 -0.2231 2877 0.8235 -0.01537 0.01223
ran_pars mother_pidlink sd__(Intercept) 0.02896 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.123 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.07311 0.08329 -0.8777 3683 0.3801 -0.2364 0.09014
fixed NA birth_order -0.0002085 0.001148 -0.1815 3335 0.856 -0.002459 0.002042
fixed NA poly(age, 3, raw = TRUE)1 0.009956 0.008945 1.113 3682 0.2658 -0.007576 0.02749
fixed NA poly(age, 3, raw = TRUE)2 -0.0003358 0.0003064 -1.096 3681 0.2733 -0.0009364 0.0002648
fixed NA poly(age, 3, raw = TRUE)3 0.00000366 0.000003359 1.09 3679 0.2759 -0.000002924 0.00001024
fixed NA male -0.003746 0.004215 -0.8887 3687 0.3742 -0.01201 0.004516
fixed NA sibling_count3 -0.005571 0.007599 -0.7331 3188 0.4636 -0.02046 0.009323
fixed NA sibling_count4 -0.005497 0.007721 -0.7119 3038 0.4766 -0.02063 0.009636
fixed NA sibling_count5 -0.001332 0.008257 -0.1613 2837 0.8719 -0.01751 0.01485
fixed NA sibling_count>5 -0.0008368 0.008118 -0.1031 2879 0.9179 -0.01675 0.01507
ran_pars mother_pidlink sd__(Intercept) 0.02901 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1231 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.07406 0.08335 -0.8886 3679 0.3743 -0.2374 0.0893
fixed NA poly(age, 3, raw = TRUE)1 0.009711 0.008946 1.086 3679 0.2778 -0.007823 0.02725
fixed NA poly(age, 3, raw = TRUE)2 -0.0003301 0.0003065 -1.077 3678 0.2815 -0.0009309 0.0002706
fixed NA poly(age, 3, raw = TRUE)3 0.000003623 0.000003361 1.078 3676 0.281 -0.000002963 0.00001021
fixed NA male -0.003724 0.004215 -0.8835 3683 0.377 -0.01199 0.004537
fixed NA sibling_count3 -0.005213 0.00773 -0.6743 3246 0.5001 -0.02036 0.009938
fixed NA sibling_count4 -0.005691 0.007954 -0.7155 3154 0.4744 -0.02128 0.009899
fixed NA sibling_count5 -0.0003466 0.008631 -0.04016 3035 0.968 -0.01726 0.01657
fixed NA sibling_count>5 0.0007911 0.008365 0.09457 3023 0.9247 -0.0156 0.01719
fixed NA birth_order_nonlinear2 0.011 0.005694 1.933 3397 0.05337 -0.000156 0.02217
fixed NA birth_order_nonlinear3 -0.001224 0.006636 -0.1845 3474 0.8536 -0.01423 0.01178
fixed NA birth_order_nonlinear4 0.005638 0.007857 0.7176 3538 0.4731 -0.009762 0.02104
fixed NA birth_order_nonlinear5 -0.003972 0.009571 -0.415 3542 0.6782 -0.02273 0.01479
fixed NA birth_order_nonlinear>5 -0.00001819 0.008764 -0.002076 3603 0.9983 -0.0172 0.01716
ran_pars mother_pidlink sd__(Intercept) 0.0295 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1229 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.06463 0.08354 -0.7736 3669 0.4392 -0.2284 0.09911
fixed NA poly(age, 3, raw = TRUE)1 0.008684 0.008969 0.9682 3669 0.333 -0.008895 0.02626
fixed NA poly(age, 3, raw = TRUE)2 -0.0002926 0.0003074 -0.9519 3667 0.3412 -0.000895 0.0003099
fixed NA poly(age, 3, raw = TRUE)3 0.000003186 0.000003371 0.9452 3665 0.3446 -0.000003421 0.000009793
fixed NA male -0.003631 0.004221 -0.8603 3672 0.3897 -0.0119 0.004642
fixed NA count_birth_order2/2 0.009313 0.01203 0.7738 3441 0.4391 -0.01427 0.0329
fixed NA count_birth_order1/3 -0.01236 0.01012 -1.221 3672 0.2222 -0.03219 0.00748
fixed NA count_birth_order2/3 0.0116 0.01102 1.052 3673 0.2927 -0.01001 0.03321
fixed NA count_birth_order3/3 -0.003213 0.01222 -0.2628 3674 0.7927 -0.02717 0.02074
fixed NA count_birth_order1/4 -0.01075 0.01098 -0.9789 3672 0.3277 -0.03228 0.01078
fixed NA count_birth_order2/4 0.01045 0.01158 0.9025 3674 0.3668 -0.01224 0.03314
fixed NA count_birth_order3/4 -0.002847 0.01253 -0.2271 3674 0.8203 -0.02741 0.02172
fixed NA count_birth_order4/4 -0.007088 0.01361 -0.5207 3673 0.6026 -0.03377 0.01959
fixed NA count_birth_order1/5 0.01516 0.01328 1.141 3674 0.2538 -0.01087 0.04118
fixed NA count_birth_order2/5 0.008984 0.01362 0.6598 3674 0.5094 -0.01771 0.03567
fixed NA count_birth_order3/5 -0.01683 0.01401 -1.201 3673 0.2298 -0.0443 0.01063
fixed NA count_birth_order4/5 -0.007029 0.01427 -0.4927 3672 0.6223 -0.03499 0.02093
fixed NA count_birth_order5/5 0.003691 0.01449 0.2548 3670 0.7989 -0.0247 0.03208
fixed NA count_birth_order1/>5 0.004812 0.01198 0.4017 3671 0.6879 -0.01866 0.02829
fixed NA count_birth_order2/>5 -0.003156 0.01266 -0.2493 3674 0.8032 -0.02797 0.02166
fixed NA count_birth_order3/>5 0.0007469 0.0122 0.06123 3674 0.9512 -0.02316 0.02465
fixed NA count_birth_order4/>5 0.01669 0.01185 1.408 3673 0.1592 -0.006541 0.03992
fixed NA count_birth_order5/>5 -0.009497 0.01255 -0.7565 3670 0.4494 -0.0341 0.01511
fixed NA count_birth_order>5/>5 0.000137 0.009443 0.01451 3530 0.9884 -0.01837 0.01865
ran_pars mother_pidlink sd__(Intercept) 0.03021 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1227 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -4793 -4725 2408 -4815 NA NA NA
12 -4791 -4717 2408 -4815 0.03277 1 0.8563
16 -4789 -4689 2410 -4821 5.725 4 0.2207
26 -4781 -4619 2416 -4833 11.8 10 0.2989

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.0498 0.0826 -0.603 3596 0.5466 -0.2117 0.1121
fixed NA poly(age, 3, raw = TRUE)1 0.007002 0.008874 0.789 3596 0.4302 -0.01039 0.0244
fixed NA poly(age, 3, raw = TRUE)2 -0.0002367 0.0003043 -0.778 3594 0.4366 -0.0008331 0.0003596
fixed NA poly(age, 3, raw = TRUE)3 0.000002649 0.000003339 0.7933 3592 0.4277 -0.000003896 0.000009194
fixed NA male -0.002382 0.004174 -0.5707 3600 0.5683 -0.01056 0.005798
fixed NA sibling_count3 -0.00575 0.00661 -0.8699 3113 0.3844 -0.01871 0.007206
fixed NA sibling_count4 0.002621 0.006909 0.3793 2913 0.7045 -0.01092 0.01616
fixed NA sibling_count5 -0.001736 0.007888 -0.22 2508 0.8259 -0.0172 0.01373
fixed NA sibling_count>5 -0.001253 0.006699 -0.187 2492 0.8517 -0.01438 0.01188
ran_pars mother_pidlink sd__(Intercept) 0.02772 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1205 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.04939 0.08263 -0.5978 3595 0.55 -0.2113 0.1126
fixed NA birth_order 0.0003003 0.001312 0.2289 3402 0.819 -0.002272 0.002872
fixed NA poly(age, 3, raw = TRUE)1 0.006922 0.008882 0.7793 3593 0.4358 -0.01049 0.02433
fixed NA poly(age, 3, raw = TRUE)2 -0.0002347 0.0003045 -0.7709 3592 0.4408 -0.0008314 0.000362
fixed NA poly(age, 3, raw = TRUE)3 0.00000264 0.00000334 0.7903 3590 0.4294 -0.000003907 0.000009186
fixed NA male -0.002386 0.004174 -0.5716 3599 0.5676 -0.01057 0.005795
fixed NA sibling_count3 -0.005903 0.006644 -0.8883 3110 0.3744 -0.01893 0.00712
fixed NA sibling_count4 0.002296 0.007054 0.3255 2911 0.7449 -0.01153 0.01612
fixed NA sibling_count5 -0.002258 0.008213 -0.2749 2532 0.7834 -0.01835 0.01384
fixed NA sibling_count>5 -0.002324 0.008174 -0.2844 2644 0.7762 -0.01835 0.0137
ran_pars mother_pidlink sd__(Intercept) 0.02771 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1205 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.05159 0.08271 -0.6238 3591 0.5328 -0.2137 0.1105
fixed NA poly(age, 3, raw = TRUE)1 0.007037 0.008885 0.792 3590 0.4284 -0.01038 0.02445
fixed NA poly(age, 3, raw = TRUE)2 -0.0002395 0.0003046 -0.7862 3589 0.4318 -0.0008365 0.0003575
fixed NA poly(age, 3, raw = TRUE)3 0.0000027 0.000003342 0.8077 3587 0.4193 -0.000003851 0.00000925
fixed NA male -0.002368 0.004176 -0.567 3595 0.5708 -0.01055 0.005817
fixed NA sibling_count3 -0.00439 0.006788 -0.6468 3184 0.5178 -0.01769 0.008914
fixed NA sibling_count4 0.00465 0.007327 0.6346 3063 0.5257 -0.009711 0.01901
fixed NA sibling_count5 0.00009162 0.008584 0.01067 2760 0.9915 -0.01673 0.01692
fixed NA sibling_count>5 -0.0008097 0.008416 -0.09621 2796 0.9234 -0.0173 0.01568
fixed NA birth_order_nonlinear2 0.005265 0.005486 0.9597 3320 0.3373 -0.005488 0.01602
fixed NA birth_order_nonlinear3 -0.005105 0.006471 -0.7888 3379 0.4303 -0.01779 0.007579
fixed NA birth_order_nonlinear4 -0.002657 0.008121 -0.3272 3434 0.7435 -0.01857 0.01326
fixed NA birth_order_nonlinear5 0.002499 0.01001 0.2497 3430 0.8029 -0.01712 0.02212
fixed NA birth_order_nonlinear>5 0.003725 0.009781 0.3809 3554 0.7033 -0.01544 0.02289
ran_pars mother_pidlink sd__(Intercept) 0.02781 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1205 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.05244 0.08302 -0.6316 3580 0.5277 -0.2152 0.1103
fixed NA poly(age, 3, raw = TRUE)1 0.007219 0.008922 0.8091 3579 0.4185 -0.01027 0.0247
fixed NA poly(age, 3, raw = TRUE)2 -0.0002477 0.000306 -0.8097 3578 0.4182 -0.0008474 0.0003519
fixed NA poly(age, 3, raw = TRUE)3 0.000002801 0.000003358 0.8341 3575 0.4043 -0.000003781 0.000009382
fixed NA male -0.002176 0.004184 -0.5202 3585 0.603 -0.01038 0.006024
fixed NA count_birth_order2/2 0.004609 0.01046 0.4405 3320 0.6596 -0.0159 0.02511
fixed NA count_birth_order1/3 -0.004567 0.008804 -0.5187 3584 0.604 -0.02182 0.01269
fixed NA count_birth_order2/3 -0.002892 0.009793 -0.2953 3586 0.7678 -0.02209 0.0163
fixed NA count_birth_order3/3 -0.00515 0.01055 -0.4882 3586 0.6255 -0.02583 0.01553
fixed NA count_birth_order1/4 0.007362 0.01033 0.7125 3585 0.4762 -0.01289 0.02761
fixed NA count_birth_order2/4 0.01055 0.01086 0.972 3586 0.3311 -0.01073 0.03184
fixed NA count_birth_order3/4 0.00207 0.01127 0.1836 3585 0.8543 -0.02002 0.02416
fixed NA count_birth_order4/4 -0.007332 0.01224 -0.5988 3585 0.5494 -0.03133 0.01667
fixed NA count_birth_order1/5 -0.006338 0.01351 -0.4691 3586 0.639 -0.03282 0.02014
fixed NA count_birth_order2/5 0.02056 0.01509 1.362 3585 0.1732 -0.009021 0.05014
fixed NA count_birth_order3/5 -0.01572 0.01472 -1.068 3584 0.2855 -0.04457 0.01313
fixed NA count_birth_order4/5 -0.004808 0.01417 -0.3393 3583 0.7344 -0.03258 0.02296
fixed NA count_birth_order5/5 0.009342 0.01505 0.6207 3582 0.5349 -0.02016 0.03884
fixed NA count_birth_order1/>5 -0.001178 0.01317 -0.0895 3584 0.9287 -0.02698 0.02463
fixed NA count_birth_order2/>5 0.001312 0.01332 0.0985 3586 0.9215 -0.02479 0.02741
fixed NA count_birth_order3/>5 -0.009649 0.01272 -0.7588 3586 0.448 -0.03457 0.01527
fixed NA count_birth_order4/>5 0.007954 0.01277 0.6227 3583 0.5335 -0.01708 0.03299
fixed NA count_birth_order5/>5 -0.002177 0.01199 -0.1815 3584 0.856 -0.02568 0.02133
fixed NA count_birth_order>5/>5 0.002798 0.009292 0.3011 3378 0.7634 -0.01541 0.02101
ran_pars mother_pidlink sd__(Intercept) 0.02796 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1206 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -4839 -4771 2430 -4861 NA NA NA
12 -4837 -4762 2430 -4861 0.05301 1 0.8179
16 -4832 -4732 2432 -4864 2.872 4 0.5795
26 -4817 -4656 2434 -4869 5.404 10 0.8626

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Sector_Finance, insurance, real estate and business services

birthorder <- birthorder %>% mutate(outcome = `Sector_Finance, insurance, real estate and business services`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.07441 0.09233 -0.8059 9530 0.4203 -0.2554 0.1066
fixed NA poly(age, 3, raw = TRUE)1 0.02539 0.008265 3.072 9465 0.002134 0.009189 0.04159
fixed NA poly(age, 3, raw = TRUE)2 -0.0006471 0.0002316 -2.795 9346 0.005207 -0.001101 -0.0001933
fixed NA poly(age, 3, raw = TRUE)3 0.000005081 0.000002052 2.476 9211 0.01331 0.000001059 0.000009104
fixed NA male 0.0594 0.008556 6.943 9661 4.073e-12 0.04264 0.07617
fixed NA sibling_count3 -0.007552 0.01779 -0.4245 7229 0.6712 -0.04241 0.02731
fixed NA sibling_count4 -0.02384 0.01795 -1.328 6797 0.1842 -0.05903 0.01135
fixed NA sibling_count5 -0.02626 0.01865 -1.407 6338 0.1593 -0.06282 0.01031
fixed NA sibling_count>5 -0.05315 0.0145 -3.664 7081 0.00025 -0.08158 -0.02472
ran_pars mother_pidlink sd__(Intercept) 0.1381 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3954 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.07441 0.09233 -0.8059 9528 0.4203 -0.2554 0.1066
fixed NA birth_order 0.0000267 0.001729 0.01544 8590 0.9877 -0.003363 0.003416
fixed NA poly(age, 3, raw = TRUE)1 0.02538 0.008279 3.066 9455 0.002179 0.009153 0.04161
fixed NA poly(age, 3, raw = TRUE)2 -0.0006469 0.0002322 -2.785 9308 0.005357 -0.001102 -0.0001917
fixed NA poly(age, 3, raw = TRUE)3 0.000005079 0.000002058 2.467 9156 0.01363 0.000001045 0.000009114
fixed NA male 0.0594 0.008556 6.943 9660 4.087e-12 0.04263 0.07617
fixed NA sibling_count3 -0.007559 0.01779 -0.4248 7240 0.671 -0.04243 0.02732
fixed NA sibling_count4 -0.02386 0.01799 -1.327 6843 0.1847 -0.05911 0.01139
fixed NA sibling_count5 -0.02628 0.01875 -1.402 6425 0.1609 -0.06303 0.01046
fixed NA sibling_count>5 -0.05324 0.01573 -3.386 7806 0.0007137 -0.08406 -0.02242
ran_pars mother_pidlink sd__(Intercept) 0.1381 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3954 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.07779 0.09248 -0.8411 9533 0.4003 -0.2591 0.1035
fixed NA poly(age, 3, raw = TRUE)1 0.02597 0.008287 3.134 9457 0.001729 0.00973 0.04221
fixed NA poly(age, 3, raw = TRUE)2 -0.0006675 0.0002324 -2.872 9313 0.004084 -0.001123 -0.000212
fixed NA poly(age, 3, raw = TRUE)3 0.000005269 0.000002059 2.558 9158 0.01053 0.000001233 0.000009306
fixed NA male 0.05941 0.008557 6.943 9656 4.091e-12 0.04264 0.07618
fixed NA sibling_count3 -0.01047 0.01806 -0.58 7487 0.5619 -0.04586 0.02492
fixed NA sibling_count4 -0.02378 0.01848 -1.287 7308 0.1981 -0.06 0.01243
fixed NA sibling_count5 -0.02538 0.01939 -1.309 7012 0.1906 -0.06338 0.01262
fixed NA sibling_count>5 -0.0482 0.01647 -2.927 8436 0.003436 -0.08049 -0.01592
fixed NA birth_order_nonlinear2 -0.0008122 0.01249 -0.06505 8957 0.9481 -0.02528 0.02366
fixed NA birth_order_nonlinear3 0.01115 0.0145 0.7694 8796 0.4417 -0.01726 0.03957
fixed NA birth_order_nonlinear4 -0.01657 0.0163 -1.016 8869 0.3094 -0.04852 0.01538
fixed NA birth_order_nonlinear5 -0.005199 0.01831 -0.2839 8915 0.7765 -0.04109 0.03069
fixed NA birth_order_nonlinear>5 -0.01029 0.01518 -0.6782 9740 0.4976 -0.04004 0.01945
ran_pars mother_pidlink sd__(Intercept) 0.1378 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3955 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.06935 0.09283 -0.7471 9535 0.455 -0.2513 0.1126
fixed NA poly(age, 3, raw = TRUE)1 0.02651 0.008296 3.195 9448 0.001401 0.01025 0.04277
fixed NA poly(age, 3, raw = TRUE)2 -0.0006742 0.0002325 -2.899 9302 0.003748 -0.00113 -0.0002185
fixed NA poly(age, 3, raw = TRUE)3 0.000005249 0.00000206 2.548 9145 0.01087 0.000001211 0.000009288
fixed NA male 0.05988 0.008562 6.994 9646 2.849e-12 0.0431 0.07666
fixed NA count_birth_order2/2 -0.04629 0.02487 -1.861 8848 0.06278 -0.09504 0.002463
fixed NA count_birth_order1/3 -0.01612 0.02398 -0.6721 9657 0.5015 -0.06313 0.03089
fixed NA count_birth_order2/3 -0.02574 0.02667 -0.9651 9693 0.3345 -0.07801 0.02653
fixed NA count_birth_order3/3 -0.04184 0.02927 -1.429 9712 0.1529 -0.09922 0.01553
fixed NA count_birth_order1/4 -0.05395 0.02639 -2.044 9695 0.04093 -0.1057 -0.00223
fixed NA count_birth_order2/4 -0.02768 0.0283 -0.978 9706 0.3281 -0.08314 0.02779
fixed NA count_birth_order3/4 -0.02782 0.02984 -0.9325 9718 0.3511 -0.0863 0.03066
fixed NA count_birth_order4/4 -0.05826 0.03211 -1.814 9726 0.06971 -0.1212 0.004687
fixed NA count_birth_order1/5 -0.05281 0.02975 -1.775 9720 0.07586 -0.1111 0.00549
fixed NA count_birth_order2/5 -0.02327 0.03158 -0.7369 9724 0.4612 -0.08516 0.03862
fixed NA count_birth_order3/5 -0.02847 0.03321 -0.8573 9729 0.3913 -0.09357 0.03662
fixed NA count_birth_order4/5 -0.09112 0.03505 -2.6 9727 0.009348 -0.1598 -0.02242
fixed NA count_birth_order5/5 -0.03226 0.03512 -0.9184 9730 0.3584 -0.1011 0.03658
fixed NA count_birth_order1/>5 -0.08272 0.023 -3.596 9728 0.0003251 -0.1278 -0.03763
fixed NA count_birth_order2/>5 -0.06344 0.02391 -2.654 9730 0.007977 -0.1103 -0.01658
fixed NA count_birth_order3/>5 -0.04458 0.02366 -1.884 9730 0.05959 -0.09096 0.001796
fixed NA count_birth_order4/>5 -0.07335 0.02319 -3.163 9729 0.001565 -0.1188 -0.0279
fixed NA count_birth_order5/>5 -0.0759 0.02343 -3.239 9730 0.001205 -0.1218 -0.02997
fixed NA count_birth_order>5/>5 -0.07606 0.01898 -4.007 8923 0.00006187 -0.1133 -0.03886
ran_pars mother_pidlink sd__(Intercept) 0.1378 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3956 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 10644 10723 -5311 10622 NA NA NA
12 10646 10732 -5311 10622 0.0002311 1 0.9879
16 10651 10766 -5309 10619 3.022 4 0.5542
26 10661 10848 -5305 10609 9.616 10 0.4748

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5687 0.2886 -1.971 3661 0.04884 -1.134 -0.003089
fixed NA poly(age, 3, raw = TRUE)1 0.0821 0.03095 2.653 3661 0.008023 0.02144 0.1428
fixed NA poly(age, 3, raw = TRUE)2 -0.002522 0.00106 -2.378 3661 0.01744 -0.0046 -0.0004438
fixed NA poly(age, 3, raw = TRUE)3 0.00002507 0.00001162 2.157 3659 0.03108 0.000002289 0.00004785
fixed NA male 0.05418 0.01459 3.715 3662 0.0002064 0.0256 0.08277
fixed NA sibling_count3 -0.03401 0.02387 -1.424 3039 0.1544 -0.0808 0.01278
fixed NA sibling_count4 -0.04521 0.02461 -1.837 2803 0.06634 -0.09345 0.00303
fixed NA sibling_count5 -0.09774 0.02738 -3.57 2460 0.000364 -0.1514 -0.04408
fixed NA sibling_count>5 -0.08594 0.02364 -3.636 2414 0.0002831 -0.1323 -0.03961
ran_pars mother_pidlink sd__(Intercept) 0.1082 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4226 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5687 0.2886 -1.97 3660 0.04887 -1.134 -0.002995
fixed NA birth_order -0.00005679 0.004499 -0.01262 3418 0.9899 -0.008875 0.008761
fixed NA poly(age, 3, raw = TRUE)1 0.08212 0.03097 2.651 3659 0.008057 0.02141 0.1428
fixed NA poly(age, 3, raw = TRUE)2 -0.002522 0.001061 -2.378 3659 0.01747 -0.004602 -0.0004432
fixed NA poly(age, 3, raw = TRUE)3 0.00002507 0.00001163 2.157 3657 0.0311 0.000002286 0.00004786
fixed NA male 0.05418 0.01459 3.714 3661 0.0002069 0.02559 0.08278
fixed NA sibling_count3 -0.03398 0.02398 -1.417 3036 0.1566 -0.08098 0.01303
fixed NA sibling_count4 -0.04515 0.02511 -1.798 2796 0.07225 -0.09435 0.00406
fixed NA sibling_count5 -0.09764 0.02856 -3.419 2488 0.0006391 -0.1536 -0.04166
fixed NA sibling_count>5 -0.08574 0.02859 -2.999 2527 0.002739 -0.1418 -0.0297
ran_pars mother_pidlink sd__(Intercept) 0.1083 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4226 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5737 0.2889 -1.986 3656 0.04713 -1.14 -0.007463
fixed NA poly(age, 3, raw = TRUE)1 0.08249 0.03098 2.662 3656 0.007795 0.02176 0.1432
fixed NA poly(age, 3, raw = TRUE)2 -0.002533 0.001061 -2.387 3655 0.01703 -0.004613 -0.0004533
fixed NA poly(age, 3, raw = TRUE)3 0.00002515 0.00001163 2.162 3654 0.03067 0.000002352 0.00004795
fixed NA male 0.05423 0.01459 3.715 3657 0.0002059 0.02562 0.08283
fixed NA sibling_count3 -0.02672 0.02446 -1.092 3126 0.2748 -0.07466 0.02122
fixed NA sibling_count4 -0.03303 0.02605 -1.268 2977 0.2049 -0.08408 0.01803
fixed NA sibling_count5 -0.08304 0.02994 -2.773 2757 0.005585 -0.1417 -0.02435
fixed NA sibling_count>5 -0.07479 0.02938 -2.546 2686 0.01096 -0.1324 -0.01721
fixed NA birth_order_nonlinear2 0.004422 0.01941 0.2278 3302 0.8198 -0.03362 0.04246
fixed NA birth_order_nonlinear3 -0.03044 0.02277 -1.337 3372 0.1813 -0.07506 0.01418
fixed NA birth_order_nonlinear4 -0.02453 0.02778 -0.8831 3436 0.3772 -0.07898 0.02992
fixed NA birth_order_nonlinear5 -0.01353 0.03407 -0.3972 3455 0.6913 -0.0803 0.05324
fixed NA birth_order_nonlinear>5 -0.002097 0.03345 -0.06269 3611 0.95 -0.06766 0.06347
ran_pars mother_pidlink sd__(Intercept) 0.1081 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4227 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5355 0.2901 -1.846 3645 0.06495 -1.104 0.03302
fixed NA poly(age, 3, raw = TRUE)1 0.07959 0.03111 2.558 3645 0.01057 0.01861 0.1406
fixed NA poly(age, 3, raw = TRUE)2 -0.002426 0.001066 -2.276 3644 0.02293 -0.004515 -0.0003364
fixed NA poly(age, 3, raw = TRUE)3 0.00002391 0.00001169 2.046 3642 0.04087 0.000001001 0.00004681
fixed NA male 0.05452 0.01462 3.73 3647 0.0001947 0.02587 0.08318
fixed NA count_birth_order2/2 -0.03903 0.03789 -1.03 3315 0.3031 -0.1133 0.03524
fixed NA count_birth_order1/3 -0.04971 0.03161 -1.573 3647 0.1158 -0.1117 0.01223
fixed NA count_birth_order2/3 -0.01491 0.03514 -0.4244 3649 0.6713 -0.08378 0.05396
fixed NA count_birth_order3/3 -0.08276 0.03828 -2.162 3650 0.0307 -0.1578 -0.007725
fixed NA count_birth_order1/4 -0.05126 0.03626 -1.414 3648 0.1576 -0.1223 0.01981
fixed NA count_birth_order2/4 -0.05105 0.03844 -1.328 3650 0.1843 -0.1264 0.0243
fixed NA count_birth_order3/4 -0.09079 0.03987 -2.277 3649 0.02283 -0.1689 -0.01265
fixed NA count_birth_order4/4 -0.03882 0.04268 -0.9094 3649 0.3632 -0.1225 0.04484
fixed NA count_birth_order1/5 -0.1067 0.04777 -2.234 3650 0.02554 -0.2003 -0.0131
fixed NA count_birth_order2/5 -0.08707 0.05153 -1.69 3648 0.0912 -0.1881 0.01394
fixed NA count_birth_order3/5 -0.1337 0.04899 -2.728 3648 0.006396 -0.2297 -0.03764
fixed NA count_birth_order4/5 -0.1599 0.04779 -3.345 3646 0.0008298 -0.2535 -0.06621
fixed NA count_birth_order5/5 -0.05661 0.0503 -1.126 3644 0.2604 -0.1552 0.04196
fixed NA count_birth_order1/>5 -0.09304 0.04523 -2.057 3648 0.03977 -0.1817 -0.004385
fixed NA count_birth_order2/>5 -0.07479 0.0456 -1.64 3650 0.101 -0.1642 0.01458
fixed NA count_birth_order3/>5 -0.08138 0.0445 -1.829 3648 0.06752 -0.1686 0.005839
fixed NA count_birth_order4/>5 -0.1182 0.04357 -2.712 3646 0.006714 -0.2035 -0.03277
fixed NA count_birth_order5/>5 -0.1354 0.04163 -3.253 3646 0.001154 -0.217 -0.05382
fixed NA count_birth_order>5/>5 -0.0913 0.03241 -2.817 3435 0.004868 -0.1548 -0.02779
ran_pars mother_pidlink sd__(Intercept) 0.1074 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.423 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 4337 4406 -2158 4315 NA NA NA
12 4339 4414 -2158 4315 0.00009047 1 0.9924
16 4344 4444 -2156 4312 2.997 4 0.5583
26 4357 4518 -2152 4305 7.716 10 0.6566

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5662 0.2875 -1.97 3685 0.04896 -1.13 -0.002767
fixed NA poly(age, 3, raw = TRUE)1 0.08105 0.03086 2.626 3685 0.008667 0.02057 0.1415
fixed NA poly(age, 3, raw = TRUE)2 -0.002488 0.001058 -2.353 3684 0.01867 -0.004561 -0.0004157
fixed NA poly(age, 3, raw = TRUE)3 0.00002469 0.0000116 2.129 3682 0.03331 0.000001961 0.00004741
fixed NA male 0.05379 0.01454 3.699 3686 0.0002198 0.02529 0.0823
fixed NA sibling_count3 -0.01975 0.0262 -0.7539 3108 0.4509 -0.0711 0.0316
fixed NA sibling_count4 -0.03216 0.0264 -1.218 2954 0.2233 -0.08391 0.01959
fixed NA sibling_count5 -0.07215 0.02778 -2.597 2729 0.00945 -0.1266 -0.0177
fixed NA sibling_count>5 -0.07094 0.02436 -2.912 2772 0.003615 -0.1187 -0.0232
ran_pars mother_pidlink sd__(Intercept) 0.1094 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4225 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5664 0.2875 -1.97 3684 0.04893 -1.13 -0.002844
fixed NA birth_order -0.0002095 0.00397 -0.05278 3318 0.9579 -0.007991 0.007572
fixed NA poly(age, 3, raw = TRUE)1 0.0811 0.03088 2.626 3683 0.008664 0.02058 0.1416
fixed NA poly(age, 3, raw = TRUE)2 -0.002489 0.001058 -2.353 3683 0.01866 -0.004563 -0.0004162
fixed NA poly(age, 3, raw = TRUE)3 0.00002469 0.0000116 2.129 3681 0.03332 0.00000196 0.00004742
fixed NA male 0.0538 0.01455 3.699 3685 0.0002199 0.02529 0.08231
fixed NA sibling_count3 -0.01965 0.02628 -0.7476 3102 0.4547 -0.07115 0.03186
fixed NA sibling_count4 -0.03195 0.02671 -1.196 2940 0.2317 -0.08429 0.0204
fixed NA sibling_count5 -0.0718 0.02857 -2.513 2725 0.01204 -0.1278 -0.01579
fixed NA sibling_count>5 -0.0702 0.02809 -2.499 2777 0.01251 -0.1253 -0.01515
ran_pars mother_pidlink sd__(Intercept) 0.1096 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4225 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.578 0.2878 -2.008 3680 0.04468 -1.142 -0.01393
fixed NA poly(age, 3, raw = TRUE)1 0.08201 0.03089 2.655 3680 0.007962 0.02147 0.1426
fixed NA poly(age, 3, raw = TRUE)2 -0.002519 0.001058 -2.38 3680 0.01736 -0.004593 -0.0004445
fixed NA poly(age, 3, raw = TRUE)3 0.00002491 0.0000116 2.147 3678 0.03186 0.00000217 0.00004766
fixed NA male 0.05398 0.01455 3.71 3681 0.0002105 0.02546 0.08249
fixed NA sibling_count3 -0.01423 0.02673 -0.5325 3168 0.5945 -0.06663 0.03816
fixed NA sibling_count4 -0.01948 0.02751 -0.7081 3066 0.4789 -0.07341 0.03444
fixed NA sibling_count5 -0.05724 0.02986 -1.917 2939 0.05532 -0.1158 0.00128
fixed NA sibling_count>5 -0.05202 0.02894 -1.798 2932 0.07236 -0.1087 0.004701
fixed NA birth_order_nonlinear2 0.01072 0.01963 0.5459 3341 0.5851 -0.02776 0.04919
fixed NA birth_order_nonlinear3 -0.02222 0.02288 -0.9713 3427 0.3315 -0.06707 0.02262
fixed NA birth_order_nonlinear4 -0.03943 0.0271 -1.455 3502 0.1457 -0.09254 0.01368
fixed NA birth_order_nonlinear5 -0.007367 0.03301 -0.2232 3504 0.8234 -0.07206 0.05733
fixed NA birth_order_nonlinear>5 -0.01766 0.03028 -0.5834 3604 0.5597 -0.077 0.04168
ran_pars mother_pidlink sd__(Intercept) 0.1108 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4222 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.512 0.2882 -1.776 3669 0.07576 -1.077 0.05292
fixed NA poly(age, 3, raw = TRUE)1 0.07721 0.03094 2.495 3669 0.01263 0.01656 0.1379
fixed NA poly(age, 3, raw = TRUE)2 -0.002343 0.001061 -2.209 3668 0.02725 -0.004421 -0.0002639
fixed NA poly(age, 3, raw = TRUE)3 0.00002292 0.00001163 1.97 3666 0.04887 0.0000001211 0.00004571
fixed NA male 0.05323 0.01456 3.656 3671 0.0002601 0.02469 0.08177
fixed NA count_birth_order2/2 -0.06461 0.04148 -1.558 3403 0.1194 -0.1459 0.01669
fixed NA count_birth_order1/3 -0.0366 0.03492 -1.048 3670 0.2946 -0.105 0.03184
fixed NA count_birth_order2/3 -0.01324 0.03804 -0.348 3673 0.7279 -0.08779 0.06131
fixed NA count_birth_order3/3 -0.08953 0.04217 -2.123 3674 0.0338 -0.1722 -0.006883
fixed NA count_birth_order1/4 -0.08289 0.0379 -2.187 3672 0.02879 -0.1572 -0.008614
fixed NA count_birth_order2/4 0.00127 0.03994 0.03181 3674 0.9746 -0.077 0.07955
fixed NA count_birth_order3/4 -0.08315 0.04323 -1.923 3673 0.05453 -0.1679 0.001588
fixed NA count_birth_order4/4 -0.04866 0.04696 -1.036 3672 0.3002 -0.1407 0.04338
fixed NA count_birth_order1/5 -0.06946 0.04581 -1.516 3674 0.1296 -0.1592 0.02033
fixed NA count_birth_order2/5 -0.1132 0.04698 -2.409 3674 0.01604 -0.2052 -0.0211
fixed NA count_birth_order3/5 -0.1311 0.04834 -2.712 3672 0.006716 -0.2258 -0.03636
fixed NA count_birth_order4/5 -0.1211 0.04921 -2.46 3671 0.01395 -0.2175 -0.02459
fixed NA count_birth_order5/5 -0.03203 0.04997 -0.641 3668 0.5216 -0.13 0.06591
fixed NA count_birth_order1/>5 -0.08991 0.04133 -2.176 3670 0.02964 -0.1709 -0.008917
fixed NA count_birth_order2/>5 -0.04979 0.04368 -1.14 3674 0.2543 -0.1354 0.03581
fixed NA count_birth_order3/>5 -0.04301 0.04208 -1.022 3673 0.3068 -0.1255 0.03947
fixed NA count_birth_order4/>5 -0.1407 0.04088 -3.442 3672 0.0005847 -0.2208 -0.06057
fixed NA count_birth_order5/>5 -0.1239 0.0433 -2.86 3668 0.004254 -0.2087 -0.03899
fixed NA count_birth_order>5/>5 -0.09545 0.0326 -2.928 3509 0.003433 -0.1593 -0.03156
ran_pars mother_pidlink sd__(Intercept) 0.1099 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.422 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 4369 4437 -2173 4347 NA NA NA
12 4371 4445 -2173 4347 0.00247 1 0.9604
16 4375 4474 -2171 4343 4.144 4 0.3868
26 4378 4539 -2163 4326 16.88 10 0.07713

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5595 0.2914 -1.92 3597 0.05495 -1.131 0.01169
fixed NA poly(age, 3, raw = TRUE)1 0.0817 0.03131 2.609 3597 0.009112 0.02033 0.1431
fixed NA poly(age, 3, raw = TRUE)2 -0.0025 0.001074 -2.329 3597 0.01992 -0.004605 -0.0003961
fixed NA poly(age, 3, raw = TRUE)3 0.00002474 0.00001178 2.1 3595 0.03583 0.000001645 0.00004783
fixed NA male 0.05654 0.01472 3.841 3598 0.0001245 0.02769 0.08539
fixed NA sibling_count3 -0.05676 0.02338 -2.427 2984 0.01526 -0.1026 -0.01093
fixed NA sibling_count4 -0.04937 0.02446 -2.019 2758 0.04362 -0.0973 -0.001435
fixed NA sibling_count5 -0.1102 0.02796 -3.94 2318 0.00008386 -0.1649 -0.05536
fixed NA sibling_count>5 -0.09375 0.02374 -3.949 2307 0.00008091 -0.1403 -0.04722
ran_pars mother_pidlink sd__(Intercept) 0.1108 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.422 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5626 0.2915 -1.93 3596 0.0537 -1.134 0.008759
fixed NA birth_order -0.002165 0.004637 -0.467 3394 0.6405 -0.01125 0.006922
fixed NA poly(age, 3, raw = TRUE)1 0.08229 0.03134 2.626 3595 0.008682 0.02087 0.1437
fixed NA poly(age, 3, raw = TRUE)2 -0.002516 0.001074 -2.342 3595 0.01924 -0.004621 -0.0004102
fixed NA poly(age, 3, raw = TRUE)3 0.00002481 0.00001178 2.105 3593 0.03532 0.000001714 0.00004791
fixed NA male 0.05657 0.01472 3.843 3597 0.0001237 0.02772 0.08543
fixed NA sibling_count3 -0.05566 0.02351 -2.368 2981 0.01796 -0.1017 -0.009586
fixed NA sibling_count4 -0.04701 0.02497 -1.882 2757 0.05988 -0.09596 0.001936
fixed NA sibling_count5 -0.1064 0.02911 -3.654 2347 0.0002637 -0.1634 -0.04932
fixed NA sibling_count>5 -0.08602 0.02896 -2.97 2481 0.003008 -0.1428 -0.02925
ran_pars mother_pidlink sd__(Intercept) 0.1114 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4219 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5677 0.2918 -1.946 3592 0.05178 -1.14 0.004187
fixed NA poly(age, 3, raw = TRUE)1 0.08282 0.03135 2.642 3592 0.008283 0.02137 0.1443
fixed NA poly(age, 3, raw = TRUE)2 -0.002528 0.001075 -2.352 3591 0.01871 -0.004634 -0.0004216
fixed NA poly(age, 3, raw = TRUE)3 0.00002487 0.00001179 2.108 3590 0.03506 0.000001751 0.00004798
fixed NA male 0.05634 0.01473 3.826 3593 0.0001327 0.02748 0.08521
fixed NA sibling_count3 -0.04861 0.024 -2.025 3073 0.04297 -0.09565 -0.001557
fixed NA sibling_count4 -0.03533 0.02592 -1.363 2934 0.1731 -0.08613 0.01548
fixed NA sibling_count5 -0.09458 0.0304 -3.111 2597 0.001882 -0.1542 -0.035
fixed NA sibling_count>5 -0.07499 0.0298 -2.517 2648 0.01191 -0.1334 -0.01659
fixed NA birth_order_nonlinear2 -0.01061 0.01931 -0.5491 3236 0.5829 -0.04846 0.02725
fixed NA birth_order_nonlinear3 -0.03414 0.02279 -1.499 3306 0.1341 -0.0788 0.01051
fixed NA birth_order_nonlinear4 -0.03378 0.0286 -1.181 3372 0.2377 -0.08984 0.02228
fixed NA birth_order_nonlinear5 -0.01735 0.03526 -0.4922 3364 0.6226 -0.08645 0.05175
fixed NA birth_order_nonlinear>5 -0.0251 0.03452 -0.727 3560 0.4672 -0.09277 0.04257
ran_pars mother_pidlink sd__(Intercept) 0.111 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4221 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.5353 0.2929 -1.827 3581 0.06771 -1.109 0.03882
fixed NA poly(age, 3, raw = TRUE)1 0.08019 0.03148 2.547 3581 0.01089 0.01849 0.1419
fixed NA poly(age, 3, raw = TRUE)2 -0.002433 0.00108 -2.254 3580 0.02427 -0.004549 -0.0003172
fixed NA poly(age, 3, raw = TRUE)3 0.00002378 0.00001185 2.007 3578 0.04477 0.0000005629 0.00004701
fixed NA male 0.0564 0.01476 3.822 3583 0.0001344 0.02748 0.08533
fixed NA count_birth_order2/2 -0.04001 0.03684 -1.086 3248 0.2775 -0.1122 0.03219
fixed NA count_birth_order1/3 -0.06363 0.03106 -2.049 3582 0.04058 -0.1245 -0.002752
fixed NA count_birth_order2/3 -0.05555 0.03455 -1.608 3586 0.1079 -0.1233 0.01216
fixed NA count_birth_order3/3 -0.09984 0.03721 -2.683 3585 0.00733 -0.1728 -0.0269
fixed NA count_birth_order1/4 -0.04157 0.03645 -1.141 3585 0.2541 -0.113 0.02987
fixed NA count_birth_order2/4 -0.06433 0.0383 -1.68 3586 0.09312 -0.1394 0.01074
fixed NA count_birth_order3/4 -0.09248 0.03975 -2.326 3585 0.02005 -0.1704 -0.01457
fixed NA count_birth_order4/4 -0.05644 0.04319 -1.307 3584 0.1914 -0.1411 0.02821
fixed NA count_birth_order1/5 -0.127 0.04766 -2.664 3586 0.007762 -0.2204 -0.03354
fixed NA count_birth_order2/5 -0.1031 0.05323 -1.937 3583 0.05282 -0.2074 0.00122
fixed NA count_birth_order3/5 -0.1444 0.05191 -2.782 3582 0.005427 -0.2462 -0.04268
fixed NA count_birth_order4/5 -0.1675 0.04997 -3.352 3581 0.0008116 -0.2654 -0.06954
fixed NA count_birth_order5/5 -0.06378 0.05308 -1.202 3579 0.2296 -0.1678 0.04025
fixed NA count_birth_order1/>5 -0.08858 0.04645 -1.907 3585 0.0566 -0.1796 0.002461
fixed NA count_birth_order2/>5 -0.08499 0.04697 -1.809 3585 0.07048 -0.1771 0.007076
fixed NA count_birth_order3/>5 -0.08575 0.04485 -1.912 3584 0.05597 -0.1737 0.002157
fixed NA count_birth_order4/>5 -0.1208 0.04505 -2.683 3580 0.00734 -0.2091 -0.03255
fixed NA count_birth_order5/>5 -0.1342 0.04229 -3.172 3581 0.001526 -0.217 -0.05126
fixed NA count_birth_order>5/>5 -0.11 0.03283 -3.35 3344 0.0008166 -0.1743 -0.04564
ran_pars mother_pidlink sd__(Intercept) 0.1107 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4224 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 4263 4331 -2120 4241 NA NA NA
12 4264 4339 -2120 4240 0.2157 1 0.6424
16 4270 4369 -2119 4238 2.603 4 0.6264
26 4284 4445 -2116 4232 5.553 10 0.8513

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Sector_Manufacturing

birthorder <- birthorder %>% mutate(outcome = Sector_Manufacturing)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5117 0.09457 5.41 9545 0.00000006439 0.3263 0.6971
fixed NA poly(age, 3, raw = TRUE)1 -0.01479 0.008466 -1.747 9484 0.08064 -0.03138 0.001801
fixed NA poly(age, 3, raw = TRUE)2 0.0002146 0.0002372 0.9045 9372 0.3657 -0.0002504 0.0006795
fixed NA poly(age, 3, raw = TRUE)3 -0.0000006725 0.000002103 -0.3198 9243 0.7491 -0.000004794 0.000003449
fixed NA male -0.02311 0.008759 -2.639 9657 0.008339 -0.04028 -0.005944
fixed NA sibling_count3 -0.006571 0.01824 -0.3603 7295 0.7186 -0.04232 0.02917
fixed NA sibling_count4 -0.00687 0.01841 -0.3732 6877 0.709 -0.04295 0.02921
fixed NA sibling_count5 0.01292 0.01913 0.6752 6430 0.4996 -0.02458 0.05042
fixed NA sibling_count>5 0.01186 0.01487 0.7972 7153 0.4254 -0.01729 0.04101
ran_pars mother_pidlink sd__(Intercept) 0.1442 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4041 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5117 0.09458 5.41 9543 0.00000006447 0.3263 0.6971
fixed NA birth_order -0.0001019 0.001772 -0.05749 8686 0.9542 -0.003576 0.003372
fixed NA poly(age, 3, raw = TRUE)1 -0.01476 0.008481 -1.741 9475 0.08175 -0.03139 0.001859
fixed NA poly(age, 3, raw = TRUE)2 0.0002136 0.0002379 0.8976 9335 0.3694 -0.0002528 0.0006799
fixed NA poly(age, 3, raw = TRUE)3 -0.0000006633 0.000002109 -0.3145 9190 0.7532 -0.000004797 0.00000347
fixed NA male -0.02311 0.00876 -2.638 9656 0.008349 -0.04028 -0.005941
fixed NA sibling_count3 -0.006544 0.01824 -0.3587 7305 0.7198 -0.0423 0.02921
fixed NA sibling_count4 -0.006808 0.01844 -0.3691 6922 0.712 -0.04296 0.02934
fixed NA sibling_count5 0.01303 0.01923 0.6776 6515 0.4981 -0.02465 0.05071
fixed NA sibling_count>5 0.01221 0.01612 0.7577 7866 0.4487 -0.01938 0.04381
ran_pars mother_pidlink sd__(Intercept) 0.1442 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4041 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.5096 0.09474 5.379 9548 0.00000007651 0.3239 0.6953
fixed NA poly(age, 3, raw = TRUE)1 -0.01469 0.008489 -1.731 9478 0.08354 -0.03133 0.001947
fixed NA poly(age, 3, raw = TRUE)2 0.0002074 0.0002381 0.8713 9341 0.3836 -0.0002592 0.000674
fixed NA poly(age, 3, raw = TRUE)3 -0.0000005849 0.00000211 -0.2772 9193 0.7816 -0.000004721 0.000003551
fixed NA male -0.02303 0.008761 -2.629 9652 0.008575 -0.04021 -0.005862
fixed NA sibling_count3 -0.005231 0.01851 -0.2826 7547 0.7775 -0.04152 0.03105
fixed NA sibling_count4 -0.007222 0.01895 -0.3811 7377 0.7031 -0.04436 0.02992
fixed NA sibling_count5 0.01484 0.01988 0.7462 7091 0.4556 -0.02413 0.0538
fixed NA sibling_count>5 0.01629 0.01688 0.965 8476 0.3346 -0.0168 0.04938
fixed NA birth_order_nonlinear2 0.008384 0.01278 0.6562 8982 0.5117 -0.01666 0.03343
fixed NA birth_order_nonlinear3 -0.003908 0.01484 -0.2634 8821 0.7922 -0.03299 0.02517
fixed NA birth_order_nonlinear4 0.01104 0.01668 0.6616 8889 0.5082 -0.02166 0.04373
fixed NA birth_order_nonlinear5 -0.01119 0.01874 -0.5973 8932 0.5503 -0.04792 0.02554
fixed NA birth_order_nonlinear>5 -0.004781 0.01554 -0.3076 9740 0.7584 -0.03525 0.02568
ran_pars mother_pidlink sd__(Intercept) 0.1441 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4042 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4939 0.09509 5.194 9550 0.00000021 0.3075 0.6803
fixed NA poly(age, 3, raw = TRUE)1 -0.01421 0.008498 -1.673 9469 0.09446 -0.03087 0.002443
fixed NA poly(age, 3, raw = TRUE)2 0.0001951 0.0002382 0.8191 9331 0.4128 -0.0002718 0.0006621
fixed NA poly(age, 3, raw = TRUE)3 -0.000000494 0.000002111 -0.234 9181 0.815 -0.000004632 0.000003644
fixed NA male -0.02312 0.008766 -2.638 9642 0.008356 -0.0403 -0.005942
fixed NA count_birth_order2/2 0.03648 0.02545 1.433 8886 0.1519 -0.01341 0.08636
fixed NA count_birth_order1/3 0.01974 0.02457 0.8034 9655 0.4218 -0.02841 0.06788
fixed NA count_birth_order2/3 0.009603 0.02731 0.3516 9692 0.7252 -0.04393 0.06314
fixed NA count_birth_order3/3 -0.02071 0.02998 -0.6908 9712 0.4897 -0.07947 0.03805
fixed NA count_birth_order1/4 0.008555 0.02702 0.3166 9694 0.7516 -0.04441 0.06152
fixed NA count_birth_order2/4 0.0266 0.02898 0.9179 9706 0.3587 -0.0302 0.08341
fixed NA count_birth_order3/4 -0.03689 0.03056 -1.207 9718 0.2273 -0.09678 0.02299
fixed NA count_birth_order4/4 0.02723 0.03289 0.8279 9726 0.4077 -0.03723 0.09169
fixed NA count_birth_order1/5 0.04031 0.03046 1.323 9719 0.1858 -0.01939 0.1
fixed NA count_birth_order2/5 0.02362 0.03234 0.7304 9724 0.4651 -0.03976 0.087
fixed NA count_birth_order3/5 0.03578 0.03401 1.052 9729 0.2928 -0.03088 0.1024
fixed NA count_birth_order4/5 0.008249 0.03589 0.2298 9727 0.8182 -0.0621 0.0786
fixed NA count_birth_order5/5 0.01433 0.03597 0.3985 9730 0.6903 -0.05616 0.08483
fixed NA count_birth_order1/>5 0.01689 0.02356 0.717 9728 0.4734 -0.02928 0.06306
fixed NA count_birth_order2/>5 0.01899 0.02448 0.7757 9730 0.4379 -0.02899 0.06698
fixed NA count_birth_order3/>5 0.04577 0.02423 1.889 9730 0.05895 -0.001725 0.09326
fixed NA count_birth_order4/>5 0.04063 0.02374 1.711 9729 0.08707 -0.005906 0.08717
fixed NA count_birth_order5/>5 0.01524 0.024 0.6352 9730 0.5253 -0.03179 0.06228
fixed NA count_birth_order>5/>5 0.02177 0.01945 1.119 8952 0.263 -0.01635 0.05989
ran_pars mother_pidlink sd__(Intercept) 0.1442 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4041 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 11106 11186 -5542 11084 NA NA NA
12 11108 11195 -5542 11084 0.003397 1 0.9535
16 11114 11229 -5541 11082 2.159 4 0.7066
26 11124 11311 -5536 11072 9.91 10 0.4484

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.6945 0.2861 2.428 3664 0.01524 0.1338 1.255
fixed NA poly(age, 3, raw = TRUE)1 -0.03818 0.03069 -1.244 3664 0.2135 -0.09833 0.02196
fixed NA poly(age, 3, raw = TRUE)2 0.001072 0.001051 1.02 3664 0.3077 -0.000988 0.003133
fixed NA poly(age, 3, raw = TRUE)3 -0.00001043 0.00001152 -0.9051 3664 0.3655 -0.00003302 0.00001216
fixed NA male -0.01913 0.01445 -1.324 3657 0.1856 -0.04746 0.00919
fixed NA sibling_count3 0.001268 0.02378 0.05334 2960 0.9575 -0.04534 0.04787
fixed NA sibling_count4 0.02087 0.02454 0.8503 2724 0.3952 -0.02723 0.06896
fixed NA sibling_count5 0.02786 0.02734 1.019 2386 0.3083 -0.02573 0.08144
fixed NA sibling_count>5 0.01755 0.02361 0.7432 2351 0.4575 -0.02873 0.06382
ran_pars mother_pidlink sd__(Intercept) 0.1269 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4136 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.6924 0.2862 2.42 3663 0.01558 0.1316 1.253
fixed NA birth_order -0.001776 0.004471 -0.3974 3464 0.6911 -0.01054 0.006986
fixed NA poly(age, 3, raw = TRUE)1 -0.03775 0.03071 -1.229 3663 0.2191 -0.09793 0.02244
fixed NA poly(age, 3, raw = TRUE)2 0.001062 0.001052 1.009 3663 0.3129 -0.0009998 0.003123
fixed NA poly(age, 3, raw = TRUE)3 -0.00001039 0.00001153 -0.9014 3663 0.3675 -0.00003298 0.0000122
fixed NA male -0.01907 0.01445 -1.32 3656 0.1871 -0.0474 0.009257
fixed NA sibling_count3 0.002154 0.02388 0.09018 2960 0.9281 -0.04466 0.04896
fixed NA sibling_count4 0.02283 0.02503 0.9121 2721 0.3618 -0.02623 0.07188
fixed NA sibling_count5 0.03107 0.02851 1.09 2421 0.2759 -0.02481 0.08695
fixed NA sibling_count>5 0.02391 0.02854 0.838 2480 0.4021 -0.03202 0.07985
ran_pars mother_pidlink sd__(Intercept) 0.1266 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4138 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.7097 0.2864 2.478 3659 0.01325 0.1484 1.271
fixed NA poly(age, 3, raw = TRUE)1 -0.04004 0.03071 -1.304 3659 0.1924 -0.1002 0.02015
fixed NA poly(age, 3, raw = TRUE)2 0.001135 0.001052 1.079 3659 0.2808 -0.0009269 0.003197
fixed NA poly(age, 3, raw = TRUE)3 -0.00001111 0.00001153 -0.9635 3659 0.3354 -0.00003371 0.00001149
fixed NA male -0.01949 0.01446 -1.348 3651 0.1776 -0.04783 0.00884
fixed NA sibling_count3 0.002157 0.02435 0.08859 3053 0.9294 -0.04557 0.04989
fixed NA sibling_count4 0.01402 0.02595 0.5401 2906 0.5892 -0.03685 0.06489
fixed NA sibling_count5 0.02613 0.02986 0.875 2692 0.3817 -0.0324 0.08466
fixed NA sibling_count>5 0.02047 0.02931 0.6984 2640 0.485 -0.03697 0.07791
fixed NA birth_order_nonlinear2 0.008278 0.01916 0.4321 3242 0.6657 -0.02927 0.04583
fixed NA birth_order_nonlinear3 -0.003106 0.02248 -0.1381 3311 0.8901 -0.04717 0.04096
fixed NA birth_order_nonlinear4 0.0427 0.02744 1.556 3377 0.1199 -0.01109 0.09649
fixed NA birth_order_nonlinear5 -0.029 0.03366 -0.8614 3392 0.3891 -0.09497 0.03698
fixed NA birth_order_nonlinear>5 -0.005666 0.03318 -0.1707 3635 0.8644 -0.07071 0.05938
ran_pars mother_pidlink sd__(Intercept) 0.128 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4133 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.7378 0.2875 2.566 3649 0.01033 0.1742 1.301
fixed NA poly(age, 3, raw = TRUE)1 -0.04289 0.03084 -1.391 3649 0.1644 -0.1033 0.01755
fixed NA poly(age, 3, raw = TRUE)2 0.001232 0.001057 1.166 3649 0.2438 -0.0008394 0.003303
fixed NA poly(age, 3, raw = TRUE)3 -0.00001216 0.00001159 -1.05 3649 0.2939 -0.00003487 0.00001055
fixed NA male -0.01952 0.01448 -1.348 3641 0.1777 -0.0479 0.008861
fixed NA count_birth_order2/2 0.004085 0.0374 0.1092 3277 0.913 -0.06922 0.07739
fixed NA count_birth_order1/3 0.01393 0.03133 0.4445 3643 0.6567 -0.04748 0.07534
fixed NA count_birth_order2/3 0.007459 0.03483 0.2142 3649 0.8304 -0.0608 0.07572
fixed NA count_birth_order3/3 -0.02574 0.03793 -0.6785 3650 0.4975 -0.1001 0.04861
fixed NA count_birth_order1/4 -0.01898 0.03594 -0.528 3647 0.5975 -0.08942 0.05146
fixed NA count_birth_order2/4 0.0258 0.0381 0.6772 3650 0.4983 -0.04887 0.1005
fixed NA count_birth_order3/4 0.04904 0.0395 1.241 3649 0.2145 -0.02838 0.1265
fixed NA count_birth_order4/4 0.05322 0.04228 1.259 3647 0.2082 -0.02965 0.1361
fixed NA count_birth_order1/5 0.01815 0.04733 0.3835 3650 0.7014 -0.07462 0.1109
fixed NA count_birth_order2/5 0.08403 0.05105 1.646 3645 0.09984 -0.01603 0.1841
fixed NA count_birth_order3/5 -0.02305 0.04853 -0.4749 3644 0.6349 -0.1182 0.07206
fixed NA count_birth_order4/5 0.07164 0.04733 1.513 3642 0.1303 -0.02114 0.1644
fixed NA count_birth_order5/5 -0.001846 0.04981 -0.03705 3639 0.9704 -0.09947 0.09578
fixed NA count_birth_order1/>5 0.03997 0.04483 0.8917 3650 0.3726 -0.04789 0.1278
fixed NA count_birth_order2/>5 -0.008876 0.04517 -0.1965 3646 0.8442 -0.09742 0.07966
fixed NA count_birth_order3/>5 0.03244 0.04408 0.7359 3644 0.4618 -0.05396 0.1188
fixed NA count_birth_order4/>5 0.06151 0.04315 1.426 3638 0.1541 -0.02305 0.1461
fixed NA count_birth_order5/>5 -0.01123 0.04124 -0.2723 3641 0.7854 -0.09205 0.06959
fixed NA count_birth_order>5/>5 0.01346 0.0322 0.4178 3445 0.6761 -0.04966 0.07658
ran_pars mother_pidlink sd__(Intercept) 0.1285 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4133 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 4272 4341 -2125 4250 NA NA NA
12 4274 4349 -2125 4250 0.16 1 0.6892
16 4277 4377 -2123 4245 4.804 4 0.3081
26 4290 4451 -2119 4238 7.584 10 0.6694

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.6938 0.2847 2.437 3688 0.01485 0.1359 1.252
fixed NA poly(age, 3, raw = TRUE)1 -0.03908 0.03056 -1.279 3688 0.201 -0.09899 0.02082
fixed NA poly(age, 3, raw = TRUE)2 0.001103 0.001047 1.053 3688 0.2925 -0.00095 0.003155
fixed NA poly(age, 3, raw = TRUE)3 -0.00001075 0.00001148 -0.936 3688 0.3494 -0.00003326 0.00001176
fixed NA male -0.01987 0.01439 -1.381 3680 0.1675 -0.04808 0.008339
fixed NA sibling_count3 0.02057 0.02606 0.7896 3036 0.4298 -0.0305 0.07164
fixed NA sibling_count4 0.01883 0.02628 0.7167 2880 0.4736 -0.03267 0.07034
fixed NA sibling_count5 0.02997 0.02767 1.083 2658 0.2789 -0.02427 0.08421
fixed NA sibling_count>5 0.02952 0.02426 1.217 2707 0.2238 -0.01803 0.07707
ran_pars mother_pidlink sd__(Intercept) 0.1274 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4132 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.6907 0.2847 2.426 3687 0.01531 0.1327 1.249
fixed NA birth_order -0.003004 0.003942 -0.7619 3366 0.4462 -0.01073 0.004723
fixed NA poly(age, 3, raw = TRUE)1 -0.0384 0.03058 -1.256 3687 0.2093 -0.09833 0.02153
fixed NA poly(age, 3, raw = TRUE)2 0.001086 0.001048 1.037 3687 0.2999 -0.0009671 0.003139
fixed NA poly(age, 3, raw = TRUE)3 -0.0000107 0.00001148 -0.9316 3686 0.3516 -0.00003321 0.00001181
fixed NA male -0.01978 0.0144 -1.374 3680 0.1696 -0.04799 0.00844
fixed NA sibling_count3 0.02208 0.02613 0.8452 3032 0.3981 -0.02913 0.07329
fixed NA sibling_count4 0.02188 0.02657 0.8235 2868 0.4103 -0.0302 0.07397
fixed NA sibling_count5 0.03503 0.02845 1.231 2658 0.2185 -0.02074 0.0908
fixed NA sibling_count>5 0.04012 0.02797 1.435 2725 0.1515 -0.01469 0.09494
ran_pars mother_pidlink sd__(Intercept) 0.1267 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4134 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.7126 0.2849 2.501 3683 0.01241 0.1543 1.271
fixed NA poly(age, 3, raw = TRUE)1 -0.04117 0.03058 -1.347 3683 0.1782 -0.1011 0.01876
fixed NA poly(age, 3, raw = TRUE)2 0.001175 0.001048 1.122 3683 0.262 -0.000878 0.003229
fixed NA poly(age, 3, raw = TRUE)3 -0.00001154 0.00001149 -1.005 3683 0.3151 -0.00003406 0.00001097
fixed NA male -0.02032 0.01439 -1.412 3674 0.1581 -0.04853 0.007889
fixed NA sibling_count3 0.02206 0.02657 0.83 3100 0.4066 -0.03003 0.07414
fixed NA sibling_count4 0.0125 0.02736 0.4569 2998 0.6478 -0.04113 0.06613
fixed NA sibling_count5 0.03038 0.02971 1.023 2876 0.3066 -0.02785 0.08862
fixed NA sibling_count>5 0.03026 0.0288 1.051 2882 0.2935 -0.02619 0.0867
fixed NA birth_order_nonlinear2 0.000648 0.01936 0.03347 3286 0.9733 -0.0373 0.03859
fixed NA birth_order_nonlinear3 -0.006387 0.02258 -0.2829 3373 0.7773 -0.05064 0.03786
fixed NA birth_order_nonlinear4 0.04502 0.02675 1.683 3453 0.09249 -0.007412 0.09744
fixed NA birth_order_nonlinear5 -0.04231 0.03258 -1.299 3450 0.1942 -0.1062 0.02155
fixed NA birth_order_nonlinear>5 -0.003707 0.03001 -0.1235 3630 0.9017 -0.06252 0.05511
ran_pars mother_pidlink sd__(Intercept) 0.1294 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4125 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.715 0.2859 2.501 3673 0.01242 0.1548 1.275
fixed NA poly(age, 3, raw = TRUE)1 -0.04177 0.03069 -1.361 3673 0.1735 -0.1019 0.01837
fixed NA poly(age, 3, raw = TRUE)2 0.001195 0.001052 1.137 3673 0.2558 -0.0008661 0.003257
fixed NA poly(age, 3, raw = TRUE)3 -0.00001175 0.00001154 -1.019 3672 0.3084 -0.00003436 0.00001086
fixed NA male -0.02002 0.01443 -1.387 3664 0.1655 -0.0483 0.008265
fixed NA count_birth_order2/2 0.0098 0.041 0.239 3377 0.8111 -0.07055 0.09015
fixed NA count_birth_order1/3 0.03993 0.03463 1.153 3667 0.249 -0.02795 0.1078
fixed NA count_birth_order2/3 0.02923 0.03772 0.7751 3672 0.4384 -0.04469 0.1032
fixed NA count_birth_order3/3 -0.01499 0.0418 -0.3586 3674 0.7199 -0.09692 0.06694
fixed NA count_birth_order1/4 0.008483 0.03758 0.2257 3670 0.8214 -0.06518 0.08214
fixed NA count_birth_order2/4 0.00627 0.0396 0.1583 3674 0.8742 -0.07134 0.08388
fixed NA count_birth_order3/4 0.02997 0.04285 0.6994 3673 0.4843 -0.05402 0.114
fixed NA count_birth_order4/4 0.06428 0.04654 1.381 3671 0.1673 -0.02694 0.1555
fixed NA count_birth_order1/5 0.008951 0.04542 0.1971 3674 0.8438 -0.08008 0.09798
fixed NA count_birth_order2/5 0.06832 0.04657 1.467 3674 0.1425 -0.02296 0.1596
fixed NA count_birth_order3/5 0.02295 0.04791 0.4791 3670 0.6319 -0.07095 0.1169
fixed NA count_birth_order4/5 0.07555 0.04877 1.549 3667 0.1215 -0.02005 0.1711
fixed NA count_birth_order5/5 -0.01083 0.04952 -0.2187 3664 0.8269 -0.1079 0.08622
fixed NA count_birth_order1/>5 0.03972 0.04098 0.9691 3672 0.3325 -0.04061 0.12
fixed NA count_birth_order2/>5 0.00776 0.04329 0.1793 3672 0.8577 -0.07709 0.09261
fixed NA count_birth_order3/>5 0.04269 0.04171 1.024 3671 0.3061 -0.03905 0.1244
fixed NA count_birth_order4/>5 0.07782 0.04052 1.921 3669 0.05486 -0.001596 0.1572
fixed NA count_birth_order5/>5 -0.007665 0.04291 -0.1786 3662 0.8582 -0.09176 0.07643
fixed NA count_birth_order>5/>5 0.02949 0.03239 0.9104 3508 0.3627 -0.034 0.09298
ran_pars mother_pidlink sd__(Intercept) 0.1294 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4129 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 4295 4364 -2137 4273 NA NA NA
12 4297 4371 -2136 4273 0.585 1 0.4444
16 4298 4398 -2133 4266 6.406 4 0.1708
26 4314 4476 -2131 4262 4.039 10 0.9455

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.6847 0.2888 2.371 3600 0.0178 0.1186 1.251
fixed NA poly(age, 3, raw = TRUE)1 -0.03708 0.03103 -1.195 3600 0.2322 -0.0979 0.02374
fixed NA poly(age, 3, raw = TRUE)2 0.001033 0.001064 0.9707 3600 0.3318 -0.001053 0.003118
fixed NA poly(age, 3, raw = TRUE)3 -0.000009884 0.00001168 -0.8464 3599 0.3974 -0.00003277 0.000013
fixed NA male -0.02402 0.01458 -1.648 3593 0.09949 -0.0526 0.004552
fixed NA sibling_count3 0.006789 0.02327 0.2917 2910 0.7705 -0.03882 0.0524
fixed NA sibling_count4 0.01743 0.02436 0.7156 2681 0.4743 -0.03032 0.06518
fixed NA sibling_count5 0.03358 0.0279 1.204 2245 0.2289 -0.0211 0.08826
fixed NA sibling_count>5 0.0147 0.02369 0.6205 2243 0.535 -0.03174 0.06114
ran_pars mother_pidlink sd__(Intercept) 0.1271 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4135 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.6811 0.2889 2.357 3598 0.01846 0.1148 1.247
fixed NA birth_order -0.002423 0.004604 -0.5263 3430 0.5987 -0.01145 0.0066
fixed NA poly(age, 3, raw = TRUE)1 -0.03639 0.03106 -1.172 3598 0.2414 -0.09727 0.02448
fixed NA poly(age, 3, raw = TRUE)2 0.001015 0.001065 0.9533 3598 0.3405 -0.001072 0.003102
fixed NA poly(age, 3, raw = TRUE)3 -0.000009793 0.00001168 -0.8384 3598 0.4018 -0.00003269 0.0000131
fixed NA male -0.024 0.01458 -1.646 3592 0.09981 -0.05258 0.004575
fixed NA sibling_count3 0.008022 0.02339 0.343 2908 0.7317 -0.03782 0.05386
fixed NA sibling_count4 0.02008 0.02487 0.8073 2683 0.4196 -0.02867 0.06882
fixed NA sibling_count5 0.03781 0.02903 1.302 2278 0.193 -0.0191 0.09471
fixed NA sibling_count>5 0.02339 0.02887 0.81 2429 0.418 -0.0332 0.07997
ran_pars mother_pidlink sd__(Intercept) 0.1268 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4136 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.6914 0.2892 2.391 3594 0.01687 0.1246 1.258
fixed NA poly(age, 3, raw = TRUE)1 -0.03822 0.03107 -1.23 3595 0.2187 -0.09911 0.02267
fixed NA poly(age, 3, raw = TRUE)2 0.001074 0.001065 1.008 3595 0.3135 -0.001014 0.003161
fixed NA poly(age, 3, raw = TRUE)3 -0.00001037 0.00001169 -0.8876 3594 0.3748 -0.00003328 0.00001253
fixed NA male -0.02434 0.01459 -1.669 3588 0.09526 -0.05293 0.004249
fixed NA sibling_count3 0.009206 0.02388 0.3855 3004 0.6999 -0.03759 0.056
fixed NA sibling_count4 0.01429 0.0258 0.5538 2866 0.5798 -0.03628 0.06485
fixed NA sibling_count5 0.03383 0.03029 1.117 2528 0.2643 -0.02555 0.0932
fixed NA sibling_count>5 0.02141 0.02969 0.7211 2597 0.4709 -0.03678 0.0796
fixed NA birth_order_nonlinear2 0.01259 0.01907 0.6599 3177 0.5093 -0.0248 0.04997
fixed NA birth_order_nonlinear3 -0.008404 0.02251 -0.3733 3249 0.7089 -0.05252 0.03572
fixed NA birth_order_nonlinear4 0.03288 0.02827 1.163 3317 0.2448 -0.02252 0.08828
fixed NA birth_order_nonlinear5 -0.01862 0.03484 -0.5346 3303 0.593 -0.08691 0.04966
fixed NA birth_order_nonlinear>5 -0.01146 0.03423 -0.3349 3577 0.7377 -0.07856 0.05563
ran_pars mother_pidlink sd__(Intercept) 0.127 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4136 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.7099 0.2904 2.445 3584 0.01455 0.1407 1.279
fixed NA poly(age, 3, raw = TRUE)1 -0.04044 0.03121 -1.296 3584 0.1951 -0.1016 0.02073
fixed NA poly(age, 3, raw = TRUE)2 0.001151 0.00107 1.076 3584 0.2821 -0.0009463 0.003249
fixed NA poly(age, 3, raw = TRUE)3 -0.00001124 0.00001175 -0.9567 3583 0.3388 -0.00003426 0.00001178
fixed NA male -0.02448 0.01462 -1.675 3577 0.09408 -0.05314 0.00417
fixed NA count_birth_order2/2 0.01734 0.03639 0.4765 3206 0.6338 -0.05399 0.08867
fixed NA count_birth_order1/3 0.01849 0.03079 0.6004 3579 0.5483 -0.04186 0.07884
fixed NA count_birth_order2/3 0.02155 0.03424 0.6293 3585 0.5292 -0.04556 0.08866
fixed NA count_birth_order3/3 -0.009869 0.03687 -0.2676 3585 0.789 -0.08214 0.0624
fixed NA count_birth_order1/4 -0.01049 0.03613 -0.2903 3584 0.7716 -0.08131 0.06033
fixed NA count_birth_order2/4 0.027 0.03796 0.7113 3586 0.477 -0.0474 0.1014
fixed NA count_birth_order3/4 0.03907 0.03939 0.992 3584 0.3213 -0.03813 0.1163
fixed NA count_birth_order4/4 0.05482 0.04279 1.281 3583 0.2002 -0.02905 0.1387
fixed NA count_birth_order1/5 0.03448 0.04724 0.73 3586 0.4654 -0.0581 0.1271
fixed NA count_birth_order2/5 0.06907 0.05274 1.31 3579 0.1904 -0.03429 0.1724
fixed NA count_birth_order3/5 0.004936 0.05143 0.09599 3577 0.9235 -0.09586 0.1057
fixed NA count_birth_order4/5 0.06178 0.0495 1.248 3577 0.2121 -0.03524 0.1588
fixed NA count_birth_order5/5 0.02736 0.05258 0.5203 3574 0.6029 -0.0757 0.1304
fixed NA count_birth_order1/>5 0.05413 0.04604 1.176 3586 0.2398 -0.03611 0.1444
fixed NA count_birth_order2/>5 0.02108 0.04654 0.4529 3582 0.6507 -0.07015 0.1123
fixed NA count_birth_order3/>5 0.006787 0.04444 0.1527 3581 0.8786 -0.08031 0.09388
fixed NA count_birth_order4/>5 0.05472 0.04463 1.226 3572 0.2202 -0.03274 0.1422
fixed NA count_birth_order5/>5 -0.00152 0.0419 -0.03627 3576 0.9711 -0.08363 0.08059
fixed NA count_birth_order>5/>5 0.01146 0.03262 0.3515 3348 0.7253 -0.05247 0.0754
ran_pars mother_pidlink sd__(Intercept) 0.1273 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.4139 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 4196 4264 -2087 4174 NA NA NA
12 4198 4272 -2087 4174 0.2797 1 0.5969
16 4203 4302 -2085 4171 3.113 4 0.5391
26 4219 4380 -2084 4167 3.496 10 0.9672

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Sector_Mining and quarrying

birthorder <- birthorder %>% mutate(outcome = `Sector_Mining and quarrying`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.03035 0.03991 -0.7605 9543 0.447 -0.1086 0.04787
fixed NA poly(age, 3, raw = TRUE)1 0.002784 0.003572 0.7794 9482 0.4357 -0.004217 0.009786
fixed NA poly(age, 3, raw = TRUE)2 -0.00004645 0.0001001 -0.4641 9372 0.6426 -0.0002426 0.0001497
fixed NA poly(age, 3, raw = TRUE)3 0.0000002049 0.000000887 0.231 9246 0.8173 -0.000001534 0.000001943
fixed NA male 0.02971 0.0037 8.03 9672 1.089e-15 0.02246 0.03696
fixed NA sibling_count3 -0.0008367 0.007684 -0.1089 7398 0.9133 -0.0159 0.01422
fixed NA sibling_count4 0.004985 0.007755 0.6429 6978 0.5203 -0.01021 0.02018
fixed NA sibling_count5 0.006666 0.008057 0.8274 6531 0.408 -0.009125 0.02246
fixed NA sibling_count>5 0.001122 0.006266 0.179 7252 0.8579 -0.01116 0.0134
ran_pars mother_pidlink sd__(Intercept) 0.05891 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1712 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.03038 0.03991 -0.7613 9542 0.4465 -0.1086 0.04784
fixed NA birth_order 0.0005056 0.0007473 0.6765 8641 0.4987 -0.0009592 0.00197
fixed NA poly(age, 3, raw = TRUE)1 0.002644 0.003579 0.7388 9473 0.46 -0.00437 0.009658
fixed NA poly(age, 3, raw = TRUE)2 -0.00004135 0.0001004 -0.412 9336 0.6804 -0.0002381 0.0001554
fixed NA poly(age, 3, raw = TRUE)3 0.0000001591 0.0000008896 0.1788 9196 0.8581 -0.000001585 0.000001903
fixed NA male 0.0297 0.0037 8.027 9671 1.117e-15 0.02245 0.03695
fixed NA sibling_count3 -0.0009676 0.007687 -0.1259 7408 0.8998 -0.01603 0.0141
fixed NA sibling_count4 0.004674 0.007769 0.6016 7024 0.5474 -0.01055 0.0199
fixed NA sibling_count5 0.006127 0.008097 0.7568 6616 0.4492 -0.009742 0.022
fixed NA sibling_count>5 -0.000655 0.006794 -0.09641 7942 0.9232 -0.01397 0.01266
ran_pars mother_pidlink sd__(Intercept) 0.05893 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1712 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.02744 0.03998 -0.6864 9547 0.4925 -0.1058 0.05091
fixed NA poly(age, 3, raw = TRUE)1 0.002552 0.003582 0.7125 9477 0.4762 -0.004468 0.009573
fixed NA poly(age, 3, raw = TRUE)2 -0.00003768 0.0001004 -0.3752 9342 0.7076 -0.0002345 0.0001592
fixed NA poly(age, 3, raw = TRUE)3 0.0000001159 0.0000008902 0.1301 9199 0.8965 -0.000001629 0.000001861
fixed NA male 0.02973 0.0037 8.035 9666 1.047e-15 0.02248 0.03698
fixed NA sibling_count3 0.0002275 0.007802 0.02916 7639 0.9767 -0.01506 0.01552
fixed NA sibling_count4 0.004558 0.007985 0.5709 7466 0.5681 -0.01109 0.02021
fixed NA sibling_count5 0.00631 0.008377 0.7532 7181 0.4513 -0.01011 0.02273
fixed NA sibling_count>5 -0.0008504 0.007119 -0.1195 8534 0.9049 -0.0148 0.0131
fixed NA birth_order_nonlinear2 -0.004173 0.0054 -0.7729 9020 0.4396 -0.01476 0.00641
fixed NA birth_order_nonlinear3 -0.005299 0.00627 -0.8451 8872 0.3981 -0.01759 0.006991
fixed NA birth_order_nonlinear4 0.006777 0.00705 0.9613 8941 0.3364 -0.007041 0.02059
fixed NA birth_order_nonlinear5 -0.00166 0.00792 -0.2096 8985 0.834 -0.01718 0.01386
fixed NA birth_order_nonlinear>5 0.002234 0.006562 0.3404 9740 0.7335 -0.01063 0.0151
ran_pars mother_pidlink sd__(Intercept) 0.05905 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1712 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.0343 0.04011 -0.8551 9548 0.3925 -0.1129 0.04432
fixed NA poly(age, 3, raw = TRUE)1 0.002683 0.003585 0.7484 9467 0.4542 -0.004343 0.009709
fixed NA poly(age, 3, raw = TRUE)2 -0.00004222 0.0001005 -0.4202 9331 0.6744 -0.0002392 0.0001547
fixed NA poly(age, 3, raw = TRUE)3 0.0000001617 0.0000008903 0.1816 9186 0.8559 -0.000001583 0.000001907
fixed NA male 0.0297 0.003701 8.025 9657 1.132e-15 0.02245 0.03695
fixed NA count_birth_order2/2 0.01138 0.01075 1.058 8914 0.29 -0.009698 0.03246
fixed NA count_birth_order1/3 0.005769 0.01037 0.5566 9665 0.5778 -0.01455 0.02608
fixed NA count_birth_order2/3 0.01716 0.01153 1.489 9697 0.1365 -0.005428 0.03975
fixed NA count_birth_order3/3 -0.01888 0.01265 -1.492 9714 0.1357 -0.04367 0.005919
fixed NA count_birth_order1/4 0.01393 0.0114 1.222 9699 0.2218 -0.008416 0.03628
fixed NA count_birth_order2/4 -0.005393 0.01223 -0.441 9709 0.6592 -0.02936 0.01858
fixed NA count_birth_order3/4 0.009254 0.01289 0.7177 9719 0.473 -0.01602 0.03453
fixed NA count_birth_order4/4 0.02237 0.01388 1.612 9726 0.107 -0.004829 0.04958
fixed NA count_birth_order1/5 0.005794 0.01286 0.4507 9721 0.6522 -0.0194 0.03099
fixed NA count_birth_order2/5 0.009803 0.01365 0.7183 9725 0.4726 -0.01694 0.03655
fixed NA count_birth_order3/5 0.007786 0.01435 0.5424 9729 0.5876 -0.02035 0.03592
fixed NA count_birth_order4/5 0.01815 0.01515 1.198 9728 0.2309 -0.01154 0.04784
fixed NA count_birth_order5/5 0.01756 0.01518 1.157 9730 0.2473 -0.01219 0.04732
fixed NA count_birth_order1/>5 0.01252 0.009942 1.259 9729 0.2079 -0.006965 0.03201
fixed NA count_birth_order2/>5 -0.01148 0.01033 -1.111 9730 0.2666 -0.03173 0.008772
fixed NA count_birth_order3/>5 0.007394 0.01023 0.723 9730 0.4697 -0.01265 0.02744
fixed NA count_birth_order4/>5 0.01005 0.01002 1.003 9730 0.316 -0.009592 0.02969
fixed NA count_birth_order5/>5 0.001259 0.01013 0.1243 9730 0.9011 -0.01859 0.02111
fixed NA count_birth_order>5/>5 0.007163 0.0082 0.8736 8987 0.3824 -0.008909 0.02324
ran_pars mother_pidlink sd__(Intercept) 0.05892 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1712 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -5714 -5635 2868 -5736 NA NA NA
12 -5712 -5626 2868 -5736 0.4579 1 0.4986
16 -5707 -5592 2870 -5739 3.207 4 0.5238
26 -5703 -5517 2878 -5755 16.09 10 0.09704

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.0135 0.1052 -0.1283 3665 0.8979 -0.2197 0.1927
fixed NA poly(age, 3, raw = TRUE)1 0.0004965 0.01128 0.044 3665 0.9649 -0.02162 0.02261
fixed NA poly(age, 3, raw = TRUE)2 0.00002584 0.0003865 0.06685 3665 0.9467 -0.0007317 0.0007834
fixed NA poly(age, 3, raw = TRUE)3 -0.0000008291 0.000004237 -0.1957 3665 0.8449 -0.000009134 0.000007476
fixed NA male 0.02643 0.005311 4.977 3645 0.0000006762 0.01602 0.03684
fixed NA sibling_count3 0.01414 0.008772 1.612 2714 0.1071 -0.003053 0.03133
fixed NA sibling_count4 0.01755 0.00906 1.937 2445 0.05282 -0.0002053 0.03531
fixed NA sibling_count5 0.004679 0.0101 0.4631 2080 0.6433 -0.01512 0.02448
fixed NA sibling_count>5 0.01454 0.008725 1.666 2049 0.09587 -0.002565 0.03164
ran_pars mother_pidlink sd__(Intercept) 0.05107 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1508 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01511 0.1052 -0.1436 3664 0.8859 -0.2213 0.1911
fixed NA birth_order -0.00126 0.001647 -0.7652 3446 0.4442 -0.004487 0.001967
fixed NA poly(age, 3, raw = TRUE)1 0.0008181 0.01129 0.07246 3664 0.9422 -0.02131 0.02295
fixed NA poly(age, 3, raw = TRUE)2 0.00001765 0.0003867 0.04563 3664 0.9636 -0.0007403 0.0007755
fixed NA poly(age, 3, raw = TRUE)3 -0.0000007941 0.000004238 -0.1874 3664 0.8514 -0.0000091 0.000007512
fixed NA male 0.02649 0.005312 4.987 3643 0.0000006412 0.01608 0.0369
fixed NA sibling_count3 0.01478 0.008814 1.676 2712 0.09376 -0.002499 0.03205
fixed NA sibling_count4 0.01895 0.009244 2.05 2441 0.04051 0.000829 0.03706
fixed NA sibling_count5 0.006955 0.01054 0.6599 2121 0.5094 -0.0137 0.02761
fixed NA sibling_count>5 0.01908 0.01055 1.809 2201 0.07064 -0.001596 0.03975
ran_pars mother_pidlink sd__(Intercept) 0.05147 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1506 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01618 0.1053 -0.1537 3660 0.8779 -0.2226 0.1902
fixed NA poly(age, 3, raw = TRUE)1 0.00098 0.01129 0.08678 3660 0.9309 -0.02115 0.02311
fixed NA poly(age, 3, raw = TRUE)2 0.0000145 0.0003868 0.03749 3660 0.9701 -0.0007437 0.0007727
fixed NA poly(age, 3, raw = TRUE)3 -0.0000007877 0.00000424 -0.1858 3660 0.8526 -0.000009099 0.000007523
fixed NA male 0.02645 0.005314 4.978 3639 0.0000006708 0.01604 0.03687
fixed NA sibling_count3 0.01569 0.008983 1.747 2831 0.08078 -0.001915 0.0333
fixed NA sibling_count4 0.02248 0.009577 2.347 2661 0.01901 0.003705 0.04125
fixed NA sibling_count5 0.01117 0.01103 1.013 2422 0.3113 -0.01044 0.03278
fixed NA sibling_count>5 0.02095 0.01082 1.936 2377 0.05301 -0.0002616 0.04216
fixed NA birth_order_nonlinear2 -0.008145 0.007027 -1.159 3067 0.2466 -0.02192 0.005629
fixed NA birth_order_nonlinear3 -0.006853 0.008248 -0.8308 3151 0.4062 -0.02302 0.009314
fixed NA birth_order_nonlinear4 -0.01932 0.01007 -1.919 3235 0.0551 -0.03906 0.0004151
fixed NA birth_order_nonlinear5 -0.01062 0.01235 -0.8596 3250 0.3901 -0.03483 0.01359
fixed NA birth_order_nonlinear>5 -0.007731 0.01221 -0.6332 3642 0.5266 -0.03166 0.0162
ran_pars mother_pidlink sd__(Intercept) 0.05144 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1507 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.009966 0.1058 -0.09421 3649 0.9249 -0.2173 0.1974
fixed NA poly(age, 3, raw = TRUE)1 0.0004782 0.01135 0.04215 3650 0.9664 -0.02176 0.02272
fixed NA poly(age, 3, raw = TRUE)2 0.00003556 0.0003887 0.09147 3650 0.9271 -0.0007264 0.0007975
fixed NA poly(age, 3, raw = TRUE)3 -0.000001051 0.000004262 -0.2466 3650 0.8052 -0.000009405 0.000007303
fixed NA male 0.0264 0.005325 4.957 3629 0.0000007477 0.01596 0.03683
fixed NA count_birth_order2/2 -0.01641 0.01373 -1.195 3135 0.2321 -0.04332 0.0105
fixed NA count_birth_order1/3 0.00795 0.01153 0.6896 3638 0.4905 -0.01465 0.03055
fixed NA count_birth_order2/3 0.0165 0.01281 1.288 3648 0.1978 -0.00861 0.04161
fixed NA count_birth_order3/3 0.0005857 0.01395 0.04198 3650 0.9665 -0.02676 0.02793
fixed NA count_birth_order1/4 0.0207 0.01322 1.565 3646 0.1176 -0.005221 0.04661
fixed NA count_birth_order2/4 0.005796 0.01401 0.4136 3650 0.6792 -0.02167 0.03326
fixed NA count_birth_order3/4 0.008942 0.01453 0.6155 3648 0.5383 -0.01953 0.03742
fixed NA count_birth_order4/4 0.01142 0.01555 0.734 3645 0.463 -0.01907 0.0419
fixed NA count_birth_order1/5 0.007885 0.01741 0.4528 3650 0.6507 -0.02624 0.04201
fixed NA count_birth_order2/5 -0.006315 0.01877 -0.3363 3640 0.7366 -0.04311 0.03048
fixed NA count_birth_order3/5 0.008757 0.01785 0.4907 3639 0.6237 -0.02622 0.04373
fixed NA count_birth_order4/5 -0.01357 0.01741 -0.7797 3636 0.4356 -0.04769 0.02054
fixed NA count_birth_order5/5 -0.0001377 0.01832 -0.007518 3630 0.994 -0.03604 0.03576
fixed NA count_birth_order1/>5 0.02285 0.01649 1.385 3650 0.166 -0.009476 0.05517
fixed NA count_birth_order2/>5 0.008602 0.01661 0.5177 3640 0.6047 -0.02396 0.04116
fixed NA count_birth_order3/>5 0.01917 0.01621 1.182 3636 0.2371 -0.01261 0.05094
fixed NA count_birth_order4/>5 -0.01033 0.01587 -0.651 3626 0.5151 -0.04143 0.02077
fixed NA count_birth_order5/>5 0.006311 0.01516 0.4162 3632 0.6773 -0.02341 0.03603
fixed NA count_birth_order>5/>5 0.01036 0.01186 0.8735 3382 0.3824 -0.01289 0.03362
ran_pars mother_pidlink sd__(Intercept) 0.05117 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1509 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -3080 -3011 1551 -3102 NA NA NA
12 -3078 -3004 1551 -3102 0.5788 1 0.4468
16 -3074 -2975 1553 -3106 3.483 4 0.4804
26 -3059 -2897 1555 -3111 4.848 10 0.9011

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01139 0.1044 -0.1092 3689 0.9131 -0.216 0.1932
fixed NA poly(age, 3, raw = TRUE)1 0.0004498 0.0112 0.04014 3689 0.968 -0.02151 0.02241
fixed NA poly(age, 3, raw = TRUE)2 0.00002628 0.000384 0.06844 3689 0.9454 -0.0007263 0.0007788
fixed NA poly(age, 3, raw = TRUE)3 -0.0000008199 0.00000421 -0.1948 3689 0.8456 -0.000009072 0.000007432
fixed NA male 0.02609 0.005275 4.946 3670 0.0000007934 0.01575 0.03643
fixed NA sibling_count3 0.008191 0.009579 0.8551 2809 0.3926 -0.01058 0.02697
fixed NA sibling_count4 0.02248 0.009664 2.326 2627 0.02009 0.003539 0.04142
fixed NA sibling_count5 -0.0006205 0.01018 -0.06093 2378 0.9514 -0.02058 0.01934
fixed NA sibling_count>5 0.01265 0.008926 1.417 2437 0.1567 -0.00485 0.03014
ran_pars mother_pidlink sd__(Intercept) 0.05052 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1503 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01242 0.1044 -0.119 3688 0.9053 -0.217 0.1922
fixed NA birth_order -0.0009043 0.001448 -0.6243 3314 0.5324 -0.003743 0.001934
fixed NA poly(age, 3, raw = TRUE)1 0.0006657 0.01121 0.05938 3688 0.9527 -0.02131 0.02264
fixed NA poly(age, 3, raw = TRUE)2 0.00002094 0.0003841 0.05452 3688 0.9565 -0.0007318 0.0007737
fixed NA poly(age, 3, raw = TRUE)3 -0.0000008013 0.000004211 -0.1903 3688 0.8491 -0.000009054 0.000007451
fixed NA male 0.02613 0.005276 4.953 3668 0.0000007638 0.01579 0.03647
fixed NA sibling_count3 0.008654 0.00961 0.9005 2802 0.3679 -0.01018 0.02749
fixed NA sibling_count4 0.0234 0.009779 2.393 2611 0.01677 0.004236 0.04257
fixed NA sibling_count5 0.000899 0.01048 0.08581 2380 0.9316 -0.01964 0.02143
fixed NA sibling_count>5 0.01586 0.0103 1.54 2467 0.1237 -0.004323 0.03603
ran_pars mother_pidlink sd__(Intercept) 0.05085 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1502 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01457 0.1045 -0.1394 3684 0.8891 -0.2194 0.1902
fixed NA poly(age, 3, raw = TRUE)1 0.000977 0.01121 0.08712 3684 0.9306 -0.021 0.02296
fixed NA poly(age, 3, raw = TRUE)2 0.00001225 0.0003842 0.03189 3684 0.9746 -0.0007408 0.0007653
fixed NA poly(age, 3, raw = TRUE)3 -0.0000007374 0.000004213 -0.175 3684 0.8611 -0.000008995 0.00000752
fixed NA male 0.0261 0.005277 4.946 3663 0.0000007933 0.01575 0.03644
fixed NA sibling_count3 0.009587 0.00977 0.9813 2894 0.3265 -0.009562 0.02874
fixed NA sibling_count4 0.02691 0.01006 2.674 2774 0.007531 0.007189 0.04663
fixed NA sibling_count5 0.004979 0.01093 0.4555 2635 0.6488 -0.01644 0.0264
fixed NA sibling_count>5 0.01859 0.01059 1.755 2650 0.07933 -0.002169 0.03936
fixed NA birth_order_nonlinear2 -0.006724 0.007086 -0.9489 3128 0.3428 -0.02061 0.007165
fixed NA birth_order_nonlinear3 -0.00603 0.008265 -0.7296 3237 0.4657 -0.02223 0.01017
fixed NA birth_order_nonlinear4 -0.01962 0.009795 -2.003 3342 0.04525 -0.03882 -0.0004223
fixed NA birth_order_nonlinear5 -0.008111 0.01193 -0.6798 3334 0.4967 -0.0315 0.01527
fixed NA birth_order_nonlinear>5 -0.007123 0.01101 -0.6469 3628 0.5178 -0.02871 0.01446
ran_pars mother_pidlink sd__(Intercept) 0.05104 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1502 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01177 0.1048 -0.1123 3673 0.9106 -0.2172 0.1936
fixed NA poly(age, 3, raw = TRUE)1 0.0009535 0.01125 0.08475 3674 0.9325 -0.0211 0.023
fixed NA poly(age, 3, raw = TRUE)2 0.00001652 0.0003856 0.04284 3674 0.9658 -0.0007392 0.0007723
fixed NA poly(age, 3, raw = TRUE)3 -0.000000813 0.000004229 -0.1922 3674 0.8476 -0.000009102 0.000007476
fixed NA male 0.02624 0.005288 4.961 3653 0.0000007322 0.01587 0.0366
fixed NA count_birth_order2/2 -0.01773 0.01501 -1.182 3271 0.2375 -0.04714 0.01168
fixed NA count_birth_order1/3 -0.0005947 0.0127 -0.04683 3661 0.9626 -0.02549 0.0243
fixed NA count_birth_order2/3 0.01466 0.01383 1.06 3671 0.289 -0.01244 0.04177
fixed NA count_birth_order3/3 -0.009318 0.01532 -0.608 3674 0.5432 -0.03935 0.02072
fixed NA count_birth_order1/4 0.03084 0.01378 2.238 3667 0.02527 0.003834 0.05785
fixed NA count_birth_order2/4 0.009355 0.01452 0.6444 3673 0.5193 -0.0191 0.03781
fixed NA count_birth_order3/4 0.01186 0.01571 0.7549 3672 0.4504 -0.01893 0.04265
fixed NA count_birth_order4/4 0.006457 0.01706 0.3785 3668 0.7051 -0.02698 0.0399
fixed NA count_birth_order1/5 0.0004113 0.01665 0.0247 3674 0.9803 -0.03223 0.03305
fixed NA count_birth_order2/5 -0.01248 0.01707 -0.731 3673 0.4648 -0.04594 0.02098
fixed NA count_birth_order3/5 -0.004494 0.01756 -0.2559 3667 0.798 -0.03891 0.02992
fixed NA count_birth_order4/5 -0.01346 0.01788 -0.753 3662 0.4515 -0.0485 0.02157
fixed NA count_birth_order5/5 -0.002927 0.01815 -0.1613 3657 0.8719 -0.0385 0.03264
fixed NA count_birth_order1/>5 0.009889 0.01503 0.6581 3671 0.5105 -0.01956 0.03934
fixed NA count_birth_order2/>5 0.007599 0.01587 0.4788 3669 0.6321 -0.0235 0.0387
fixed NA count_birth_order3/>5 0.02187 0.01529 1.43 3668 0.1527 -0.008095 0.05183
fixed NA count_birth_order4/>5 -0.009521 0.01485 -0.6411 3665 0.5215 -0.03863 0.01959
fixed NA count_birth_order5/>5 0.004109 0.01572 0.2613 3653 0.7939 -0.02671 0.03493
fixed NA count_birth_order>5/>5 0.00764 0.01189 0.6425 3454 0.5206 -0.01566 0.03094
ran_pars mother_pidlink sd__(Intercept) 0.05089 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1503 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -3126 -3058 1574 -3148 NA NA NA
12 -3125 -3050 1574 -3149 0.3851 1 0.5349
16 -3121 -3021 1576 -3153 3.745 4 0.4416
26 -3108 -2946 1580 -3160 6.999 10 0.7256

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01066 0.1071 -0.09954 3601 0.9207 -0.2206 0.1993
fixed NA poly(age, 3, raw = TRUE)1 0.0003278 0.01151 0.02848 3601 0.9773 -0.02223 0.02289
fixed NA poly(age, 3, raw = TRUE)2 0.00003105 0.0003947 0.07867 3601 0.9373 -0.0007425 0.0008046
fixed NA poly(age, 3, raw = TRUE)3 -0.0000008807 0.000004332 -0.2033 3601 0.8389 -0.000009371 0.000007609
fixed NA male 0.02676 0.005405 4.952 3576 0.000000768 0.01617 0.03736
fixed NA sibling_count3 0.01389 0.008671 1.602 2619 0.1094 -0.003107 0.03088
fixed NA sibling_count4 0.01566 0.009086 1.723 2354 0.08493 -0.002149 0.03347
fixed NA sibling_count5 0.003031 0.01042 0.2908 1889 0.7712 -0.0174 0.02346
fixed NA sibling_count>5 0.01426 0.008852 1.611 1894 0.1074 -0.003091 0.03161
ran_pars mother_pidlink sd__(Intercept) 0.05302 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1516 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01296 0.1072 -0.1209 3600 0.9038 -0.223 0.1971
fixed NA birth_order -0.001449 0.001711 -0.8467 3426 0.3972 -0.004802 0.001905
fixed NA poly(age, 3, raw = TRUE)1 0.00075 0.01152 0.0651 3600 0.9481 -0.02183 0.02333
fixed NA poly(age, 3, raw = TRUE)2 0.00001983 0.0003949 0.05021 3600 0.96 -0.0007542 0.0007938
fixed NA poly(age, 3, raw = TRUE)3 -0.0000008209 0.000004332 -0.1895 3600 0.8497 -0.000009312 0.00000767
fixed NA male 0.02679 0.005405 4.957 3574 0.000000749 0.0162 0.03738
fixed NA sibling_count3 0.01463 0.008718 1.679 2615 0.09335 -0.002453 0.03172
fixed NA sibling_count4 0.01724 0.009279 1.858 2358 0.06327 -0.0009443 0.03543
fixed NA sibling_count5 0.005559 0.01085 0.5122 1928 0.6085 -0.01571 0.02683
fixed NA sibling_count>5 0.01948 0.01078 1.806 2110 0.07106 -0.00166 0.04061
ran_pars mother_pidlink sd__(Intercept) 0.05347 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1514 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01281 0.1072 -0.1194 3596 0.9049 -0.223 0.1974
fixed NA poly(age, 3, raw = TRUE)1 0.0007721 0.01152 0.06702 3596 0.9466 -0.02181 0.02335
fixed NA poly(age, 3, raw = TRUE)2 0.0000206 0.0003949 0.05216 3596 0.9584 -0.0007535 0.0007947
fixed NA poly(age, 3, raw = TRUE)3 -0.000000849 0.000004334 -0.1959 3596 0.8447 -0.000009343 0.000007645
fixed NA male 0.02683 0.005405 4.963 3571 0.0000007255 0.01623 0.03742
fixed NA sibling_count3 0.01413 0.008893 1.588 2740 0.1123 -0.003304 0.03156
fixed NA sibling_count4 0.01947 0.009615 2.025 2579 0.04293 0.0006293 0.03832
fixed NA sibling_count5 0.009835 0.01131 0.8699 2200 0.3845 -0.01232 0.03199
fixed NA sibling_count>5 0.02072 0.01108 1.871 2297 0.06154 -0.0009908 0.04243
fixed NA birth_order_nonlinear2 -0.007982 0.007046 -1.133 2958 0.2574 -0.02179 0.005828
fixed NA birth_order_nonlinear3 -0.001416 0.008319 -0.1702 3049 0.8649 -0.01772 0.01489
fixed NA birth_order_nonlinear4 -0.02045 0.01045 -1.957 3135 0.05041 -0.04093 0.00002855
fixed NA birth_order_nonlinear5 -0.01796 0.01288 -1.395 3107 0.1631 -0.04321 0.007276
fixed NA birth_order_nonlinear>5 -0.006144 0.0127 -0.4838 3588 0.6286 -0.03104 0.01875
ran_pars mother_pidlink sd__(Intercept) 0.0534 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1514 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.01112 0.1077 -0.1032 3586 0.9178 -0.2222 0.2
fixed NA poly(age, 3, raw = TRUE)1 0.0006036 0.01157 0.05216 3586 0.9584 -0.02208 0.02328
fixed NA poly(age, 3, raw = TRUE)2 0.00002941 0.0003968 0.07411 3586 0.9409 -0.0007484 0.0008072
fixed NA poly(age, 3, raw = TRUE)3 -0.0000009731 0.000004356 -0.2234 3586 0.8232 -0.00000951 0.000007564
fixed NA male 0.02685 0.005417 4.956 3559 0.0000007513 0.01623 0.03747
fixed NA count_birth_order2/2 -0.01103 0.01345 -0.8202 3028 0.4122 -0.03738 0.01533
fixed NA count_birth_order1/3 0.007516 0.01142 0.658 3571 0.5106 -0.01487 0.0299
fixed NA count_birth_order2/3 0.01549 0.0127 1.22 3585 0.2225 -0.009394 0.04038
fixed NA count_birth_order3/3 0.009049 0.01367 0.6619 3585 0.5081 -0.01774 0.03584
fixed NA count_birth_order1/4 0.02297 0.0134 1.714 3582 0.08658 -0.003294 0.04924
fixed NA count_birth_order2/4 0.0009928 0.01407 0.07055 3586 0.9438 -0.02659 0.02857
fixed NA count_birth_order3/4 0.01526 0.0146 1.045 3582 0.2959 -0.01335 0.04388
fixed NA count_birth_order4/4 0.005978 0.01586 0.3769 3578 0.7063 -0.02511 0.03706
fixed NA count_birth_order1/5 0.007985 0.01752 0.4559 3586 0.6485 -0.02634 0.04231
fixed NA count_birth_order2/5 -0.005466 0.01954 -0.2797 3567 0.7797 -0.04377 0.03284
fixed NA count_birth_order3/5 0.01416 0.01906 0.7431 3564 0.4575 -0.02319 0.05151
fixed NA count_birth_order4/5 -0.01167 0.01834 -0.636 3566 0.5248 -0.04762 0.02429
fixed NA count_birth_order5/5 -0.009098 0.01948 -0.467 3558 0.6405 -0.04728 0.02909
fixed NA count_birth_order1/>5 0.02622 0.01707 1.536 3585 0.1246 -0.007235 0.05967
fixed NA count_birth_order2/>5 0.01201 0.01725 0.6963 3569 0.4863 -0.0218 0.04582
fixed NA count_birth_order3/>5 0.02036 0.01647 1.236 3570 0.2165 -0.01192 0.05263
fixed NA count_birth_order4/>5 -0.009475 0.01653 -0.573 3550 0.5667 -0.04188 0.02293
fixed NA count_birth_order5/>5 0.00164 0.01552 0.1056 3561 0.9159 -0.02879 0.03207
fixed NA count_birth_order>5/>5 0.01344 0.01213 1.108 3274 0.2679 -0.01033 0.0372
ran_pars mother_pidlink sd__(Intercept) 0.05348 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1516 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -2965 -2897 1493 -2987 NA NA NA
12 -2963 -2889 1494 -2987 0.7092 1 0.3997
16 -2960 -2861 1496 -2992 4.896 4 0.2981
26 -2944 -2783 1498 -2996 3.888 10 0.9523

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Sector_Social services

birthorder <- birthorder %>% mutate(outcome = `Sector_Social services`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.02077 0.05104 0.407 9487 0.684 -0.07926 0.1208
fixed NA poly(age, 3, raw = TRUE)1 0.003093 0.004566 0.6775 9410 0.4981 -0.005855 0.01204
fixed NA poly(age, 3, raw = TRUE)2 -0.00006539 0.0001278 -0.5117 9292 0.6089 -0.0003159 0.0001851
fixed NA poly(age, 3, raw = TRUE)3 0.0000003566 0.000001132 0.3151 9167 0.7527 -0.000001862 0.000002575
fixed NA male 0.001089 0.004758 0.2289 9731 0.819 -0.008236 0.01041
fixed NA sibling_count3 -0.0007703 0.009727 -0.07919 7666 0.9369 -0.01983 0.01829
fixed NA sibling_count4 -0.006216 0.009798 -0.6344 7189 0.5259 -0.02542 0.01299
fixed NA sibling_count5 -0.01513 0.01016 -1.489 6692 0.1366 -0.03504 0.004785
fixed NA sibling_count>5 -0.005755 0.007926 -0.7261 7471 0.4678 -0.02129 0.00978
ran_pars mother_pidlink sd__(Intercept) 0.05552 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2252 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.02068 0.05103 0.4051 9486 0.6854 -0.07935 0.1207
fixed NA birth_order -0.0014 0.0009492 -1.475 7975 0.1401 -0.003261 0.0004599
fixed NA poly(age, 3, raw = TRUE)1 0.003478 0.004573 0.7606 9400 0.4469 -0.005484 0.01244
fixed NA poly(age, 3, raw = TRUE)2 -0.00007899 0.0001281 -0.6165 9255 0.5376 -0.0003301 0.0001721
fixed NA poly(age, 3, raw = TRUE)3 0.0000004777 0.000001135 0.421 9117 0.6738 -0.000001746 0.000002702
fixed NA male 0.001123 0.004758 0.2361 9730 0.8134 -0.008202 0.01045
fixed NA sibling_count3 -0.0003848 0.00973 -0.03955 7674 0.9685 -0.01946 0.01869
fixed NA sibling_count4 -0.005314 0.009817 -0.5413 7229 0.5883 -0.02456 0.01393
fixed NA sibling_count5 -0.01359 0.01021 -1.331 6767 0.1832 -0.03361 0.006424
fixed NA sibling_count>5 -0.0007645 0.008617 -0.08872 8078 0.9293 -0.01765 0.01612
ran_pars mother_pidlink sd__(Intercept) 0.0556 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2251 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01725 0.05113 0.3374 9491 0.7358 -0.08296 0.1175
fixed NA poly(age, 3, raw = TRUE)1 0.003601 0.004578 0.7867 9403 0.4315 -0.005371 0.01257
fixed NA poly(age, 3, raw = TRUE)2 -0.00008152 0.0001282 -0.6357 9261 0.525 -0.0003328 0.0001698
fixed NA poly(age, 3, raw = TRUE)3 0.0000004881 0.000001135 0.4299 9120 0.6673 -0.000001737 0.000002713
fixed NA male 0.001126 0.004759 0.2366 9725 0.813 -0.008201 0.01045
fixed NA sibling_count3 0.001311 0.009885 0.1326 7906 0.8945 -0.01806 0.02069
fixed NA sibling_count4 -0.003161 0.01011 -0.3127 7682 0.7545 -0.02297 0.01665
fixed NA sibling_count5 -0.01113 0.01059 -1.05 7359 0.2936 -0.03188 0.009633
fixed NA sibling_count>5 0.001919 0.009053 0.212 8684 0.8321 -0.01582 0.01966
fixed NA birth_order_nonlinear2 0.00005417 0.006983 0.007758 9127 0.9938 -0.01363 0.01374
fixed NA birth_order_nonlinear3 -0.009658 0.008114 -1.19 9035 0.234 -0.02556 0.006246
fixed NA birth_order_nonlinear4 -0.007049 0.00912 -0.7729 9125 0.4396 -0.02492 0.01083
fixed NA birth_order_nonlinear5 -0.009026 0.01024 -0.8813 9187 0.3782 -0.0291 0.01105
fixed NA birth_order_nonlinear>5 -0.01269 0.00842 -1.507 9711 0.1319 -0.02919 0.003817
ran_pars mother_pidlink sd__(Intercept) 0.05552 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2252 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.01213 0.05132 0.2363 9495 0.8132 -0.08846 0.1127
fixed NA poly(age, 3, raw = TRUE)1 0.00332 0.004583 0.7244 9395 0.4689 -0.005662 0.0123
fixed NA poly(age, 3, raw = TRUE)2 -0.00007672 0.0001283 -0.5978 9251 0.55 -0.0003282 0.0001748
fixed NA poly(age, 3, raw = TRUE)3 0.0000004767 0.000001136 0.4196 9108 0.6748 -0.00000175 0.000002703
fixed NA male 0.001165 0.004761 0.2448 9715 0.8066 -0.008166 0.0105
fixed NA count_birth_order2/2 0.02407 0.01392 1.729 8918 0.08384 -0.003215 0.05136
fixed NA count_birth_order1/3 0.0107 0.01329 0.8051 9707 0.4208 -0.01535 0.03675
fixed NA count_birth_order2/3 0.002195 0.01479 0.1485 9717 0.882 -0.02678 0.03117
fixed NA count_birth_order3/3 0.01111 0.01623 0.6843 9722 0.4938 -0.02071 0.04293
fixed NA count_birth_order1/4 0.01602 0.01463 1.095 9719 0.2736 -0.01265 0.04469
fixed NA count_birth_order2/4 0.003873 0.01569 0.2468 9720 0.8051 -0.02688 0.03463
fixed NA count_birth_order3/4 -0.01074 0.01655 -0.6491 9724 0.5163 -0.04318 0.02169
fixed NA count_birth_order4/4 -0.006686 0.01782 -0.3752 9726 0.7075 -0.04161 0.02824
fixed NA count_birth_order1/5 -0.00212 0.0165 -0.1285 9727 0.8978 -0.03446 0.03022
fixed NA count_birth_order2/5 -0.02531 0.01752 -1.445 9728 0.1486 -0.05964 0.00903
fixed NA count_birth_order3/5 -0.00383 0.01843 -0.2078 9729 0.8354 -0.03996 0.0323
fixed NA count_birth_order4/5 -0.003889 0.01946 -0.1998 9730 0.8416 -0.04204 0.03426
fixed NA count_birth_order5/5 0.006752 0.0195 0.3463 9730 0.7291 -0.03146 0.04496
fixed NA count_birth_order1/>5 0.01512 0.01277 1.184 9729 0.2363 -0.009901 0.04014
fixed NA count_birth_order2/>5 0.01639 0.01327 1.235 9730 0.2168 -0.009619 0.04241
fixed NA count_birth_order3/>5 -0.002849 0.01314 -0.2169 9730 0.8283 -0.0286 0.0229
fixed NA count_birth_order4/>5 0.004882 0.01287 0.3794 9730 0.7044 -0.02034 0.03011
fixed NA count_birth_order5/>5 -0.002996 0.01301 -0.2303 9730 0.8179 -0.02849 0.0225
fixed NA count_birth_order>5/>5 -0.001484 0.01046 -0.1419 9052 0.8871 -0.02198 0.01901
ran_pars mother_pidlink sd__(Intercept) 0.05579 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2251 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -837.4 -758.3 429.7 -859.4 NA NA NA
12 -837.6 -751.3 430.8 -861.6 2.178 1 0.14
16 -830.8 -715.8 431.4 -862.8 1.23 4 0.8731
26 -820.8 -634 436.4 -872.8 10.06 10 0.4357

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2203 0.156 -1.412 3658 0.158 -0.526 0.08544
fixed NA poly(age, 3, raw = TRUE)1 0.02853 0.01673 1.705 3657 0.08823 -0.004262 0.06132
fixed NA poly(age, 3, raw = TRUE)2 -0.0009087 0.0005731 -1.586 3655 0.1129 -0.002032 0.0002145
fixed NA poly(age, 3, raw = TRUE)3 0.000009383 0.000006282 1.494 3652 0.1353 -0.000002928 0.00002169
fixed NA male 0.00001633 0.007889 0.00207 3665 0.9983 -0.01545 0.01548
fixed NA sibling_count3 -0.005898 0.01284 -0.4594 3222 0.646 -0.03106 0.01926
fixed NA sibling_count4 -0.01841 0.01322 -1.393 3023 0.1637 -0.04432 0.007494
fixed NA sibling_count5 -0.001773 0.01468 -0.1208 2716 0.9039 -0.03054 0.02699
fixed NA sibling_count>5 -0.007312 0.01267 -0.5772 2659 0.5639 -0.03214 0.01752
ran_pars mother_pidlink sd__(Intercept) 0.04285 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2318 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2228 0.156 -1.428 3657 0.1533 -0.5285 0.08295
fixed NA birth_order -0.002547 0.002424 -1.051 3411 0.2934 -0.007297 0.002203
fixed NA poly(age, 3, raw = TRUE)1 0.02909 0.01674 1.738 3655 0.08232 -0.003718 0.0619
fixed NA poly(age, 3, raw = TRUE)2 -0.000922 0.0005732 -1.608 3653 0.1078 -0.002046 0.0002015
fixed NA poly(age, 3, raw = TRUE)3 0.000009422 0.000006282 1.5 3650 0.1337 -0.00000289 0.00002173
fixed NA male 0.0001252 0.00789 0.01587 3664 0.9873 -0.01534 0.01559
fixed NA sibling_count3 -0.004632 0.01289 -0.3593 3220 0.7194 -0.0299 0.02064
fixed NA sibling_count4 -0.01563 0.01348 -1.16 3015 0.2462 -0.04205 0.01078
fixed NA sibling_count5 0.002801 0.01531 0.183 2735 0.8548 -0.0272 0.0328
fixed NA sibling_count>5 0.001766 0.01533 0.1152 2746 0.9083 -0.02828 0.03181
ran_pars mother_pidlink sd__(Intercept) 0.04259 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2319 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2202 0.1562 -1.41 3653 0.1586 -0.5263 0.0859
fixed NA poly(age, 3, raw = TRUE)1 0.02881 0.01675 1.72 3652 0.08552 -0.004019 0.06163
fixed NA poly(age, 3, raw = TRUE)2 -0.0009102 0.0005736 -1.587 3650 0.1127 -0.002035 0.0002141
fixed NA poly(age, 3, raw = TRUE)3 0.000009273 0.000006287 1.475 3647 0.1403 -0.00000305 0.0000216
fixed NA male -0.00008511 0.007895 -0.01078 3660 0.9914 -0.01556 0.01539
fixed NA sibling_count3 -0.003592 0.01316 -0.2729 3288 0.7849 -0.02939 0.0222
fixed NA sibling_count4 -0.01523 0.01401 -1.088 3163 0.2769 -0.04268 0.01222
fixed NA sibling_count5 0.001798 0.01608 0.1118 2971 0.911 -0.02972 0.03331
fixed NA sibling_count>5 0.00193 0.01577 0.1224 2889 0.9026 -0.02898 0.03284
fixed NA birth_order_nonlinear2 -0.0118 0.01054 -1.119 3420 0.2631 -0.03245 0.00886
fixed NA birth_order_nonlinear3 -0.01021 0.01236 -0.8264 3476 0.4087 -0.03443 0.01401
fixed NA birth_order_nonlinear4 -0.006922 0.01507 -0.4593 3525 0.6461 -0.03646 0.02262
fixed NA birth_order_nonlinear5 -0.00769 0.01848 -0.4161 3543 0.6773 -0.04391 0.02853
fixed NA birth_order_nonlinear>5 -0.02267 0.01806 -1.255 3592 0.2096 -0.05807 0.01273
ran_pars mother_pidlink sd__(Intercept) 0.04289 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2319 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2337 0.1567 -1.491 3642 0.1359 -0.5409 0.07343
fixed NA poly(age, 3, raw = TRUE)1 0.03014 0.01681 1.793 3641 0.07307 -0.002808 0.06308
fixed NA poly(age, 3, raw = TRUE)2 -0.0009591 0.0005759 -1.665 3639 0.09591 -0.002088 0.0001696
fixed NA poly(age, 3, raw = TRUE)3 0.000009839 0.000006313 1.558 3636 0.1192 -0.000002535 0.00002221
fixed NA male -0.00011 0.007904 -0.01392 3650 0.9889 -0.0156 0.01538
fixed NA count_birth_order2/2 -0.005228 0.02055 -0.2543 3410 0.7993 -0.04551 0.03506
fixed NA count_birth_order1/3 -0.004104 0.01708 -0.2403 3649 0.8101 -0.03758 0.02937
fixed NA count_birth_order2/3 -0.03045 0.01899 -1.604 3650 0.1089 -0.06768 0.006769
fixed NA count_birth_order3/3 0.01606 0.0207 0.7762 3650 0.4377 -0.0245 0.05663
fixed NA count_birth_order1/4 -0.01085 0.0196 -0.5534 3649 0.58 -0.04925 0.02756
fixed NA count_birth_order2/4 -0.0261 0.02078 -1.256 3650 0.2091 -0.06683 0.01462
fixed NA count_birth_order3/4 -0.0325 0.02155 -1.508 3650 0.1317 -0.07474 0.009748
fixed NA count_birth_order4/4 -0.01051 0.02308 -0.4555 3650 0.6488 -0.05574 0.03472
fixed NA count_birth_order1/5 0.0168 0.02582 0.6509 3650 0.5151 -0.0338 0.06741
fixed NA count_birth_order2/5 -0.01284 0.02786 -0.4608 3650 0.645 -0.06744 0.04177
fixed NA count_birth_order3/5 -0.00643 0.02649 -0.2428 3649 0.8082 -0.05834 0.04548
fixed NA count_birth_order4/5 0.007478 0.02584 0.2894 3649 0.7723 -0.04317 0.05812
fixed NA count_birth_order5/5 -0.02538 0.0272 -0.9331 3648 0.3508 -0.07868 0.02793
fixed NA count_birth_order1/>5 0.003552 0.02444 0.1453 3646 0.8844 -0.04435 0.05146
fixed NA count_birth_order2/>5 0.02602 0.02465 1.056 3650 0.2911 -0.02229 0.07433
fixed NA count_birth_order3/>5 -0.03433 0.02406 -1.427 3650 0.1536 -0.08148 0.01282
fixed NA count_birth_order4/>5 -0.02051 0.02356 -0.8706 3649 0.3841 -0.06667 0.02566
fixed NA count_birth_order5/>5 0.009459 0.02251 0.4202 3649 0.6744 -0.03466 0.05358
fixed NA count_birth_order>5/>5 -0.01853 0.01747 -1.061 3470 0.2887 -0.05276 0.0157
ran_pars mother_pidlink sd__(Intercept) 0.04403 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2317 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -179.5 -111.2 100.8 -201.5 NA NA NA
12 -178.6 -104.1 101.3 -202.6 1.109 1 0.2924
16 -171.9 -72.52 101.9 -203.9 1.257 4 0.8687
26 -163.7 -2.307 107.9 -215.7 11.87 10 0.2936

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2294 0.1558 -1.472 3682 0.1411 -0.5348 0.07603
fixed NA poly(age, 3, raw = TRUE)1 0.02951 0.01673 1.764 3680 0.07781 -0.003278 0.0623
fixed NA poly(age, 3, raw = TRUE)2 -0.0009341 0.0005732 -1.63 3678 0.1033 -0.002058 0.0001894
fixed NA poly(age, 3, raw = TRUE)3 0.000009572 0.000006284 1.523 3674 0.1278 -0.000002745 0.00002189
fixed NA male 0.0005569 0.00789 0.07059 3689 0.9437 -0.01491 0.01602
fixed NA sibling_count3 -0.009068 0.01413 -0.6418 3278 0.5211 -0.03676 0.01863
fixed NA sibling_count4 -0.01734 0.01423 -1.218 3149 0.2231 -0.04522 0.01055
fixed NA sibling_count5 -0.01372 0.01495 -0.9178 2951 0.3588 -0.04302 0.01558
fixed NA sibling_count>5 -0.006611 0.01311 -0.5042 2978 0.6142 -0.03231 0.01909
ran_pars mother_pidlink sd__(Intercept) 0.04281 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2327 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2319 0.1558 -1.488 3680 0.1368 -0.5373 0.07352
fixed NA birth_order -0.003014 0.002142 -1.407 3319 0.1595 -0.007213 0.001185
fixed NA poly(age, 3, raw = TRUE)1 0.03012 0.01673 1.8 3678 0.07195 -0.002678 0.06292
fixed NA poly(age, 3, raw = TRUE)2 -0.0009479 0.0005732 -1.654 3676 0.09829 -0.002071 0.0001756
fixed NA poly(age, 3, raw = TRUE)3 0.000009596 0.000006283 1.527 3673 0.1268 -0.00000272 0.00002191
fixed NA male 0.0006874 0.00789 0.08713 3688 0.9306 -0.01478 0.01615
fixed NA sibling_count3 -0.00756 0.01417 -0.5336 3275 0.5936 -0.03533 0.02021
fixed NA sibling_count4 -0.01432 0.01439 -0.9953 3138 0.3197 -0.04251 0.01388
fixed NA sibling_count5 -0.008675 0.01537 -0.5644 2944 0.5725 -0.0388 0.02145
fixed NA sibling_count>5 0.003984 0.01511 0.2636 2972 0.7921 -0.02564 0.03361
ran_pars mother_pidlink sd__(Intercept) 0.04245 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2327 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2256 0.156 -1.446 3676 0.1483 -0.5314 0.08022
fixed NA poly(age, 3, raw = TRUE)1 0.02936 0.01675 1.753 3675 0.07967 -0.003465 0.06218
fixed NA poly(age, 3, raw = TRUE)2 -0.0009206 0.0005737 -1.605 3673 0.1087 -0.002045 0.0002038
fixed NA poly(age, 3, raw = TRUE)3 0.000009293 0.00000629 1.477 3669 0.1397 -0.000003036 0.00002162
fixed NA male 0.0004118 0.007895 0.05216 3684 0.9584 -0.01506 0.01589
fixed NA sibling_count3 -0.006194 0.01442 -0.4295 3326 0.6676 -0.03446 0.02207
fixed NA sibling_count4 -0.01375 0.01483 -0.9267 3241 0.3541 -0.04282 0.01533
fixed NA sibling_count5 -0.007203 0.01608 -0.4478 3127 0.6543 -0.03873 0.02432
fixed NA sibling_count>5 0.004556 0.01559 0.2923 3106 0.7701 -0.026 0.03511
fixed NA birth_order_nonlinear2 -0.01058 0.0107 -0.9893 3455 0.3226 -0.03155 0.01038
fixed NA birth_order_nonlinear3 -0.01241 0.01246 -0.9963 3523 0.3192 -0.03683 0.01201
fixed NA birth_order_nonlinear4 -0.007174 0.01475 -0.4865 3578 0.6266 -0.03607 0.02173
fixed NA birth_order_nonlinear5 -0.02097 0.01796 -1.168 3585 0.243 -0.05617 0.01423
fixed NA birth_order_nonlinear>5 -0.02246 0.01639 -1.371 3586 0.1706 -0.05457 0.009655
ran_pars mother_pidlink sd__(Intercept) 0.04251 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2328 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.2352 0.1565 -1.503 3665 0.1328 -0.5418 0.07144
fixed NA poly(age, 3, raw = TRUE)1 0.03016 0.0168 1.796 3664 0.07262 -0.002759 0.06308
fixed NA poly(age, 3, raw = TRUE)2 -0.0009527 0.0005756 -1.655 3661 0.09795 -0.002081 0.0001753
fixed NA poly(age, 3, raw = TRUE)3 0.000009682 0.000006311 1.534 3657 0.1251 -0.000002688 0.00002205
fixed NA male 0.000434 0.00791 0.05486 3674 0.9563 -0.01507 0.01594
fixed NA count_birth_order2/2 -0.00005066 0.02262 -0.00224 3477 0.9982 -0.04438 0.04428
fixed NA count_birth_order1/3 -0.008272 0.01896 -0.4363 3673 0.6626 -0.04543 0.02889
fixed NA count_birth_order2/3 -0.0263 0.02066 -1.273 3674 0.2029 -0.06679 0.01418
fixed NA count_birth_order3/3 0.01414 0.0229 0.6175 3674 0.537 -0.03075 0.05903
fixed NA count_birth_order1/4 -0.002246 0.02058 -0.1092 3673 0.9131 -0.04258 0.03808
fixed NA count_birth_order2/4 -0.03167 0.02169 -1.46 3674 0.1443 -0.07418 0.01084
fixed NA count_birth_order3/4 -0.02752 0.02348 -1.172 3674 0.2414 -0.07354 0.01851
fixed NA count_birth_order4/4 -0.008277 0.02551 -0.3244 3674 0.7456 -0.05828 0.04172
fixed NA count_birth_order1/5 0.0006942 0.02488 0.0279 3674 0.9777 -0.04807 0.04945
fixed NA count_birth_order2/5 -0.01059 0.02552 -0.4151 3674 0.6781 -0.0606 0.03942
fixed NA count_birth_order3/5 -0.01189 0.02626 -0.4526 3674 0.6508 -0.06336 0.03958
fixed NA count_birth_order4/5 -0.01932 0.02674 -0.7227 3673 0.4699 -0.07173 0.03308
fixed NA count_birth_order5/5 -0.02963 0.02715 -1.091 3672 0.2753 -0.08285 0.02359
fixed NA count_birth_order1/>5 0.01111 0.02243 0.4954 3670 0.6204 -0.03286 0.05508
fixed NA count_birth_order2/>5 0.02061 0.02372 0.8689 3673 0.385 -0.02588 0.0671
fixed NA count_birth_order3/>5 -0.02985 0.02286 -1.306 3674 0.1916 -0.07465 0.01495
fixed NA count_birth_order4/>5 0.000123 0.02221 0.005536 3674 0.9956 -0.04341 0.04365
fixed NA count_birth_order5/>5 -0.009344 0.02353 -0.3972 3673 0.6913 -0.05546 0.03677
fixed NA count_birth_order>5/>5 -0.01417 0.01765 -0.8029 3540 0.4221 -0.04877 0.02042
ran_pars mother_pidlink sd__(Intercept) 0.04262 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2328 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -155.6 -87.25 88.81 -177.6 NA NA NA
12 -155.6 -81.02 89.8 -179.6 1.987 1 0.1587
16 -148.5 -49.03 90.24 -180.5 0.8671 4 0.9292
26 -136.8 24.85 94.38 -188.8 8.28 10 0.6015

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1795 0.155 -1.158 3591 0.2468 -0.4832 0.1242
fixed NA poly(age, 3, raw = TRUE)1 0.02407 0.01665 1.446 3589 0.1484 -0.008562 0.0567
fixed NA poly(age, 3, raw = TRUE)2 -0.0007797 0.0005708 -1.366 3586 0.172 -0.001898 0.000339
fixed NA poly(age, 3, raw = TRUE)3 0.000008248 0.000006263 1.317 3580 0.1879 -0.000004027 0.00002052
fixed NA male 0.0003739 0.007836 0.04772 3601 0.9619 -0.01498 0.01573
fixed NA sibling_count3 -0.003764 0.01234 -0.3051 3194 0.7603 -0.02794 0.02041
fixed NA sibling_count4 -0.01422 0.01288 -1.105 3003 0.2694 -0.03946 0.01101
fixed NA sibling_count5 0.003677 0.01466 0.2508 2602 0.802 -0.02506 0.03241
fixed NA sibling_count>5 0.00007903 0.01245 0.006349 2567 0.9949 -0.02432 0.02448
ran_pars mother_pidlink sd__(Intercept) 0.03288 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2297 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.182 0.155 -1.174 3589 0.2403 -0.4858 0.1218
fixed NA birth_order -0.001948 0.002453 -0.7941 3343 0.4272 -0.006756 0.00286
fixed NA poly(age, 3, raw = TRUE)1 0.02457 0.01666 1.474 3587 0.1405 -0.00809 0.05722
fixed NA poly(age, 3, raw = TRUE)2 -0.0007923 0.000571 -1.387 3583 0.1654 -0.001911 0.000327
fixed NA poly(age, 3, raw = TRUE)3 0.000008303 0.000006264 1.326 3579 0.185 -0.000003973 0.00002058
fixed NA male 0.0004034 0.007837 0.05148 3600 0.9589 -0.01496 0.01576
fixed NA sibling_count3 -0.002778 0.0124 -0.2241 3191 0.8227 -0.02708 0.02152
fixed NA sibling_count4 -0.01213 0.01314 -0.9225 2997 0.3563 -0.03789 0.01364
fixed NA sibling_count5 0.007049 0.01526 0.4619 2618 0.6442 -0.02286 0.03696
fixed NA sibling_count>5 0.007013 0.0152 0.4613 2701 0.6446 -0.02278 0.03681
ran_pars mother_pidlink sd__(Intercept) 0.03272 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2297 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.18 0.1552 -1.16 3585 0.2462 -0.4841 0.1242
fixed NA poly(age, 3, raw = TRUE)1 0.02441 0.01667 1.464 3583 0.1433 -0.008266 0.05708
fixed NA poly(age, 3, raw = TRUE)2 -0.0007846 0.0005714 -1.373 3580 0.1698 -0.001905 0.0003353
fixed NA poly(age, 3, raw = TRUE)3 0.000008199 0.000006269 1.308 3576 0.191 -0.000004088 0.00002049
fixed NA male 0.000236 0.007841 0.0301 3596 0.976 -0.01513 0.0156
fixed NA sibling_count3 -0.002512 0.01268 -0.1982 3257 0.8429 -0.02736 0.02233
fixed NA sibling_count4 -0.01313 0.01367 -0.9604 3139 0.3369 -0.03992 0.01366
fixed NA sibling_count5 0.004467 0.01598 0.2795 2842 0.7799 -0.02686 0.03579
fixed NA sibling_count>5 0.006556 0.01567 0.4184 2852 0.6757 -0.02416 0.03727
fixed NA birth_order_nonlinear2 -0.01101 0.01035 -1.064 3376 0.2873 -0.03129 0.009268
fixed NA birth_order_nonlinear3 -0.006014 0.0122 -0.4931 3431 0.622 -0.02992 0.01789
fixed NA birth_order_nonlinear4 -0.001251 0.0153 -0.08179 3482 0.9348 -0.03123 0.02873
fixed NA birth_order_nonlinear5 -0.004343 0.01886 -0.2303 3484 0.8179 -0.0413 0.03262
fixed NA birth_order_nonlinear>5 -0.01995 0.01833 -1.088 3521 0.2765 -0.05587 0.01597
ran_pars mother_pidlink sd__(Intercept) 0.03303 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2298 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.1869 0.1557 -1.201 3575 0.2299 -0.492 0.1182
fixed NA poly(age, 3, raw = TRUE)1 0.02514 0.01673 1.503 3572 0.1329 -0.00764 0.05793
fixed NA poly(age, 3, raw = TRUE)2 -0.000813 0.0005736 -1.418 3569 0.1564 -0.001937 0.0003111
fixed NA poly(age, 3, raw = TRUE)3 0.000008544 0.000006294 1.357 3564 0.1747 -0.000003793 0.00002088
fixed NA male 0.0004866 0.007851 0.06198 3586 0.9506 -0.0149 0.01588
fixed NA count_birth_order2/2 -0.008769 0.01971 -0.4448 3359 0.6565 -0.04741 0.02987
fixed NA count_birth_order1/3 -0.004317 0.01651 -0.2614 3586 0.7938 -0.03669 0.02805
fixed NA count_birth_order2/3 -0.02721 0.01838 -1.481 3586 0.1388 -0.06322 0.008806
fixed NA count_birth_order3/3 0.01517 0.0198 0.7662 3586 0.4436 -0.02364 0.05398
fixed NA count_birth_order1/4 -0.01353 0.01938 -0.6981 3586 0.4851 -0.05153 0.02446
fixed NA count_birth_order2/4 -0.02109 0.02038 -1.035 3586 0.3007 -0.06103 0.01884
fixed NA count_birth_order3/4 -0.02761 0.02115 -1.306 3586 0.1918 -0.06907 0.01384
fixed NA count_birth_order4/4 -0.003205 0.02298 -0.1395 3586 0.8891 -0.04824 0.04183
fixed NA count_birth_order1/5 0.01094 0.02535 0.4314 3585 0.6662 -0.03874 0.06062
fixed NA count_birth_order2/5 -0.01583 0.02833 -0.559 3586 0.5762 -0.07135 0.03968
fixed NA count_birth_order3/5 0.007652 0.02763 0.277 3586 0.7818 -0.04649 0.0618
fixed NA count_birth_order4/5 0.01138 0.02659 0.4279 3585 0.6688 -0.04074 0.0635
fixed NA count_birth_order5/5 -0.01412 0.02825 -0.4998 3585 0.6172 -0.0695 0.04126
fixed NA count_birth_order1/>5 0.01476 0.02469 0.5976 3580 0.5502 -0.03364 0.06315
fixed NA count_birth_order2/>5 0.02997 0.02499 1.199 3584 0.2305 -0.019 0.07894
fixed NA count_birth_order3/>5 -0.02888 0.02386 -1.211 3586 0.2261 -0.07565 0.01788
fixed NA count_birth_order4/>5 -0.01081 0.02398 -0.451 3586 0.652 -0.0578 0.03618
fixed NA count_birth_order5/>5 0.01124 0.02251 0.4996 3586 0.6174 -0.03287 0.05536
fixed NA count_birth_order>5/>5 -0.01263 0.01737 -0.7269 3365 0.4673 -0.04667 0.02142
ran_pars mother_pidlink sd__(Intercept) 0.03417 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2296 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -290.8 -222.7 156.4 -312.8 NA NA NA
12 -289.4 -215.1 156.7 -313.4 0.6335 1 0.4261
16 -283 -183.9 157.5 -315 1.525 4 0.8222
26 -273 -112.1 162.5 -325 10.08 10 0.4334

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Sector_Transportation, storage and communications

birthorder <- birthorder %>% mutate(outcome = `Sector_Transportation, storage and communications`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.0652 0.04159 1.568 9516 0.1169 -0.01631 0.1467
fixed NA poly(age, 3, raw = TRUE)1 -0.003102 0.003721 -0.8336 9447 0.4045 -0.01039 0.004191
fixed NA poly(age, 3, raw = TRUE)2 0.00007889 0.0001042 0.7573 9338 0.4489 -0.0001253 0.0002831
fixed NA poly(age, 3, raw = TRUE)3 -0.0000005583 0.0000009226 -0.6052 9222 0.5451 -0.000002367 0.00000125
fixed NA male -0.01246 0.003874 -3.218 9725 0.001296 -0.02006 -0.004872
fixed NA sibling_count3 0.008001 0.007939 1.008 7753 0.3136 -0.00756 0.02356
fixed NA sibling_count4 0.009834 0.008 1.229 7307 0.219 -0.005846 0.02551
fixed NA sibling_count5 0.02201 0.008298 2.653 6836 0.008005 0.005748 0.03828
fixed NA sibling_count>5 0.01792 0.00647 2.769 7576 0.005634 0.005236 0.0306
ran_pars mother_pidlink sd__(Intercept) 0.04837 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1826 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.06522 0.04159 1.568 9515 0.1169 -0.01629 0.1467
fixed NA birth_order 0.0004447 0.0007746 0.5741 8215 0.5659 -0.001073 0.001963
fixed NA poly(age, 3, raw = TRUE)1 -0.003224 0.003727 -0.865 9437 0.3871 -0.01053 0.004081
fixed NA poly(age, 3, raw = TRUE)2 0.00008323 0.0001044 0.7969 9304 0.4256 -0.0001215 0.0002879
fixed NA poly(age, 3, raw = TRUE)3 -0.000000597 0.0000009251 -0.6454 9175 0.5187 -0.00000241 0.000001216
fixed NA male -0.01247 0.003874 -3.22 9724 0.001284 -0.02007 -0.004883
fixed NA sibling_count3 0.007879 0.007942 0.992 7762 0.3212 -0.007687 0.02345
fixed NA sibling_count4 0.00955 0.008016 1.191 7347 0.2336 -0.006161 0.02526
fixed NA sibling_count5 0.02153 0.008341 2.581 6912 0.009879 0.005178 0.03788
fixed NA sibling_count>5 0.01634 0.007032 2.323 8169 0.02019 0.002554 0.03012
ran_pars mother_pidlink sd__(Intercept) 0.04838 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1826 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.06535 0.04165 1.569 9519 0.1167 -0.01629 0.147
fixed NA poly(age, 3, raw = TRUE)1 -0.003216 0.00373 -0.8623 9440 0.3886 -0.01053 0.004095
fixed NA poly(age, 3, raw = TRUE)2 0.0000849 0.0001045 0.8124 9310 0.4166 -0.0001199 0.0002897
fixed NA poly(age, 3, raw = TRUE)3 -0.0000006214 0.0000009255 -0.6715 9178 0.5019 -0.000002435 0.000001192
fixed NA male -0.01255 0.003874 -3.241 9720 0.001196 -0.02015 -0.004962
fixed NA sibling_count3 0.007229 0.008066 0.8962 7983 0.3702 -0.008581 0.02304
fixed NA sibling_count4 0.01056 0.008249 1.28 7779 0.2006 -0.005609 0.02673
fixed NA sibling_count5 0.02083 0.008646 2.409 7477 0.01603 0.00388 0.03777
fixed NA sibling_count>5 0.01412 0.007382 1.913 8737 0.05576 -0.0003453 0.02859
fixed NA birth_order_nonlinear2 -0.001514 0.005678 -0.2667 9157 0.7897 -0.01264 0.009615
fixed NA birth_order_nonlinear3 0.003304 0.006598 0.5007 9063 0.6166 -0.009628 0.01623
fixed NA birth_order_nonlinear4 -0.007857 0.007416 -1.06 9143 0.2894 -0.02239 0.006677
fixed NA birth_order_nonlinear5 0.01102 0.008329 1.324 9198 0.1857 -0.005301 0.02735
fixed NA birth_order_nonlinear>5 0.007088 0.006857 1.034 9722 0.3013 -0.006351 0.02053
ran_pars mother_pidlink sd__(Intercept) 0.04841 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1826 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.06713 0.04182 1.605 9521 0.1085 -0.01484 0.1491
fixed NA poly(age, 3, raw = TRUE)1 -0.003226 0.003735 -0.8637 9431 0.3878 -0.01055 0.004095
fixed NA poly(age, 3, raw = TRUE)2 0.00008514 0.0001046 0.8139 9299 0.4157 -0.0001199 0.0002902
fixed NA poly(age, 3, raw = TRUE)3 -0.0000006217 0.0000009261 -0.6713 9165 0.502 -0.000002437 0.000001193
fixed NA male -0.01247 0.003877 -3.216 9710 0.001304 -0.02007 -0.004869
fixed NA count_birth_order2/2 -0.006295 0.01132 -0.556 8978 0.5783 -0.02849 0.0159
fixed NA count_birth_order1/3 0.003135 0.01083 0.2896 9704 0.7721 -0.01808 0.02435
fixed NA count_birth_order2/3 0.00541 0.01204 0.4493 9716 0.6533 -0.01819 0.02901
fixed NA count_birth_order3/3 0.01109 0.01322 0.8389 9721 0.4016 -0.01482 0.03701
fixed NA count_birth_order1/4 0.01225 0.01192 1.028 9718 0.3038 -0.0111 0.03561
fixed NA count_birth_order2/4 0.00659 0.01278 0.5156 9720 0.6062 -0.01846 0.03164
fixed NA count_birth_order3/4 0.01458 0.01348 1.082 9724 0.2793 -0.01184 0.041
fixed NA count_birth_order4/4 -0.007248 0.01451 -0.4995 9726 0.6175 -0.03569 0.02119
fixed NA count_birth_order1/5 0.004284 0.01344 0.3188 9726 0.7499 -0.02206 0.03063
fixed NA count_birth_order2/5 0.02675 0.01427 1.875 9728 0.06086 -0.001216 0.05471
fixed NA count_birth_order3/5 0.0287 0.01501 1.912 9729 0.05592 -0.0007223 0.05813
fixed NA count_birth_order4/5 0.008712 0.01585 0.5497 9730 0.5826 -0.02235 0.03978
fixed NA count_birth_order5/5 0.03591 0.01588 2.261 9730 0.02375 0.004787 0.06703
fixed NA count_birth_order1/>5 0.0164 0.0104 1.577 9729 0.1148 -0.003981 0.03677
fixed NA count_birth_order2/>5 0.008682 0.01081 0.8033 9730 0.4218 -0.0125 0.02987
fixed NA count_birth_order3/>5 0.01101 0.0107 1.029 9730 0.3035 -0.00996 0.03198
fixed NA count_birth_order4/>5 0.008169 0.01048 0.7795 9730 0.4357 -0.01237 0.02871
fixed NA count_birth_order5/>5 0.02166 0.01059 2.044 9730 0.04096 0.0008929 0.04242
fixed NA count_birth_order>5/>5 0.01945 0.008525 2.281 9095 0.02255 0.00274 0.03616
ran_pars mother_pidlink sd__(Intercept) 0.04833 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1826 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -4846 -4767 2434 -4868 NA NA NA
12 -4844 -4758 2434 -4868 0.33 1 0.5656
16 -4842 -4727 2437 -4874 5.859 4 0.2099
26 -4827 -4640 2439 -4879 4.714 10 0.9094

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.147 0.1226 1.199 3656 0.2306 -0.09325 0.3872
fixed NA poly(age, 3, raw = TRUE)1 -0.01108 0.01315 -0.8429 3654 0.3993 -0.03685 0.01468
fixed NA poly(age, 3, raw = TRUE)2 0.0003627 0.0004503 0.8054 3651 0.4207 -0.0005199 0.001245
fixed NA poly(age, 3, raw = TRUE)3 -0.000004015 0.000004936 -0.8135 3646 0.416 -0.00001369 0.000005658
fixed NA male -0.016 0.006199 -2.581 3665 0.009896 -0.02815 -0.003849
fixed NA sibling_count3 0.004867 0.01008 0.4826 3099 0.6294 -0.0149 0.02463
fixed NA sibling_count4 0.006221 0.01038 0.5992 2858 0.5491 -0.01413 0.02657
fixed NA sibling_count5 0.0261 0.01153 2.264 2501 0.02364 0.003508 0.0487
fixed NA sibling_count>5 0.01793 0.009949 1.802 2435 0.07163 -0.001569 0.03743
ran_pars mother_pidlink sd__(Intercept) 0.03293 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1823 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1438 0.1225 1.173 3654 0.2408 -0.09643 0.3839
fixed NA birth_order -0.00308 0.001903 -1.618 3333 0.1057 -0.006811 0.0006507
fixed NA poly(age, 3, raw = TRUE)1 -0.01039 0.01315 -0.7901 3652 0.4295 -0.03616 0.01538
fixed NA poly(age, 3, raw = TRUE)2 0.0003461 0.0004503 0.7686 3649 0.4422 -0.0005365 0.001229
fixed NA poly(age, 3, raw = TRUE)3 -0.000003965 0.000004934 -0.8035 3645 0.4218 -0.00001364 0.000005707
fixed NA male -0.01587 0.006198 -2.56 3664 0.01049 -0.02802 -0.003722
fixed NA sibling_count3 0.006395 0.01013 0.6316 3105 0.5277 -0.01345 0.02624
fixed NA sibling_count4 0.009575 0.01058 0.9046 2858 0.3657 -0.01117 0.03032
fixed NA sibling_count5 0.03163 0.01202 2.632 2534 0.008551 0.008072 0.05518
fixed NA sibling_count>5 0.0289 0.01203 2.401 2545 0.01641 0.005311 0.05249
ran_pars mother_pidlink sd__(Intercept) 0.03253 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1823 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1472 0.1227 1.2 3650 0.2301 -0.09317 0.3876
fixed NA poly(age, 3, raw = TRUE)1 -0.0108 0.01315 -0.821 3648 0.4117 -0.03658 0.01498
fixed NA poly(age, 3, raw = TRUE)2 0.0003645 0.0004505 0.809 3646 0.4185 -0.0005185 0.001247
fixed NA poly(age, 3, raw = TRUE)3 -0.00000422 0.000004938 -0.8547 3641 0.3928 -0.0000139 0.000005457
fixed NA male -0.01611 0.006201 -2.598 3660 0.009409 -0.02826 -0.003957
fixed NA sibling_count3 0.007144 0.01033 0.6914 3191 0.4894 -0.01311 0.0274
fixed NA sibling_count4 0.01067 0.01099 0.971 3037 0.3316 -0.01087 0.03222
fixed NA sibling_count5 0.03423 0.01262 2.713 2807 0.006716 0.009498 0.05897
fixed NA sibling_count>5 0.03208 0.01238 2.592 2709 0.009583 0.007826 0.05634
fixed NA birth_order_nonlinear2 -0.01406 0.008281 -1.698 3355 0.08955 -0.03029 0.002167
fixed NA birth_order_nonlinear3 -0.01005 0.009708 -1.035 3426 0.3006 -0.02908 0.008976
fixed NA birth_order_nonlinear4 -0.01388 0.01184 -1.172 3488 0.2412 -0.03708 0.009328
fixed NA birth_order_nonlinear5 -0.02517 0.01452 -1.734 3512 0.08299 -0.05363 0.003279
fixed NA birth_order_nonlinear>5 -0.02715 0.01418 -1.915 3567 0.05562 -0.05495 0.0006431
ran_pars mother_pidlink sd__(Intercept) 0.03234 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1824 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1428 0.1231 1.16 3639 0.2461 -0.0985 0.3841
fixed NA poly(age, 3, raw = TRUE)1 -0.01111 0.01321 -0.8416 3637 0.4001 -0.037 0.01477
fixed NA poly(age, 3, raw = TRUE)2 0.0003788 0.0004524 0.8374 3634 0.4024 -0.0005079 0.001266
fixed NA poly(age, 3, raw = TRUE)3 -0.000004428 0.00000496 -0.8929 3629 0.372 -0.00001415 0.000005292
fixed NA male -0.0164 0.00621 -2.64 3650 0.008318 -0.02857 -0.004225
fixed NA count_birth_order2/2 0.006857 0.01616 0.4242 3347 0.6714 -0.02482 0.03853
fixed NA count_birth_order1/3 0.009847 0.01342 0.7337 3649 0.4632 -0.01646 0.03615
fixed NA count_birth_order2/3 -0.0002712 0.01492 -0.01818 3650 0.9855 -0.02952 0.02898
fixed NA count_birth_order3/3 0.01219 0.01626 0.7498 3650 0.4534 -0.01968 0.04407
fixed NA count_birth_order1/4 0.02105 0.0154 1.367 3649 0.1717 -0.009128 0.05123
fixed NA count_birth_order2/4 0.009409 0.01633 0.5762 3650 0.5645 -0.02259 0.04141
fixed NA count_birth_order3/4 0.0003186 0.01694 0.01881 3650 0.985 -0.03288 0.03351
fixed NA count_birth_order4/4 -0.001352 0.01813 -0.07459 3650 0.9405 -0.03689 0.03418
fixed NA count_birth_order1/5 0.04666 0.02029 2.3 3650 0.0215 0.006901 0.08642
fixed NA count_birth_order2/5 0.0226 0.02189 1.032 3650 0.302 -0.02031 0.06551
fixed NA count_birth_order3/5 0.03762 0.02081 1.808 3649 0.07072 -0.003166 0.07842
fixed NA count_birth_order4/5 0.02517 0.0203 1.24 3649 0.2152 -0.01462 0.06497
fixed NA count_birth_order5/5 0.009177 0.02137 0.4294 3648 0.6677 -0.03271 0.05106
fixed NA count_birth_order1/>5 0.06168 0.0192 3.212 3643 0.001328 0.02405 0.09932
fixed NA count_birth_order2/>5 -0.002437 0.01937 -0.1258 3649 0.8999 -0.04039 0.03552
fixed NA count_birth_order3/>5 0.02147 0.0189 1.136 3650 0.256 -0.01558 0.05852
fixed NA count_birth_order4/>5 0.03178 0.01851 1.717 3650 0.08603 -0.004493 0.06806
fixed NA count_birth_order5/>5 0.01785 0.01769 1.009 3649 0.3131 -0.01682 0.05252
fixed NA count_birth_order>5/>5 0.01175 0.01371 0.8568 3413 0.3916 -0.01513 0.03863
ran_pars mother_pidlink sd__(Intercept) 0.0318 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1825 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -1951 -1883 986.6 -1973 NA NA NA
12 -1952 -1877 987.9 -1976 2.627 1 0.105
16 -1947 -1848 989.5 -1979 3.289 4 0.5106
26 -1936 -1774 993.8 -1988 8.507 10 0.5795

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1348 0.122 1.105 3679 0.2692 -0.1043 0.3739
fixed NA poly(age, 3, raw = TRUE)1 -0.01021 0.0131 -0.7795 3677 0.4357 -0.03588 0.01546
fixed NA poly(age, 3, raw = TRUE)2 0.0003311 0.0004488 0.7378 3673 0.4607 -0.0005485 0.001211
fixed NA poly(age, 3, raw = TRUE)3 -0.000003669 0.00000492 -0.7457 3668 0.4559 -0.00001331 0.000005974
fixed NA male -0.0162 0.006178 -2.622 3689 0.008788 -0.0283 -0.004088
fixed NA sibling_count3 0.009527 0.01106 0.8615 3170 0.389 -0.01215 0.0312
fixed NA sibling_count4 0.006535 0.01113 0.5869 3013 0.5573 -0.01529 0.02836
fixed NA sibling_count5 0.0336 0.0117 2.872 2778 0.004105 0.01067 0.05653
fixed NA sibling_count>5 0.02293 0.01026 2.235 2809 0.02552 0.002817 0.04304
ran_pars mother_pidlink sd__(Intercept) 0.03225 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1824 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.133 0.122 1.09 3677 0.2758 -0.1061 0.3721
fixed NA birth_order -0.002138 0.001677 -1.275 3214 0.2023 -0.005425 0.001148
fixed NA poly(age, 3, raw = TRUE)1 -0.009771 0.0131 -0.7458 3675 0.4558 -0.03545 0.01591
fixed NA poly(age, 3, raw = TRUE)2 0.000321 0.0004488 0.7153 3672 0.4745 -0.0005586 0.001201
fixed NA poly(age, 3, raw = TRUE)3 -0.00000365 0.00000492 -0.7418 3667 0.4582 -0.00001329 0.000005993
fixed NA male -0.01611 0.006178 -2.607 3688 0.009167 -0.02822 -0.003998
fixed NA sibling_count3 0.0106 0.01109 0.9557 3172 0.3393 -0.01114 0.03233
fixed NA sibling_count4 0.008674 0.01126 0.7704 3006 0.4411 -0.01339 0.03074
fixed NA sibling_count5 0.03718 0.01203 3.091 2779 0.002015 0.0136 0.06076
fixed NA sibling_count>5 0.03044 0.01183 2.573 2809 0.01013 0.007253 0.05362
ran_pars mother_pidlink sd__(Intercept) 0.03218 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1824 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1407 0.1221 1.152 3673 0.2494 -0.09868 0.38
fixed NA poly(age, 3, raw = TRUE)1 -0.01045 0.01311 -0.797 3672 0.4255 -0.03613 0.01524
fixed NA poly(age, 3, raw = TRUE)2 0.0003477 0.000449 0.7743 3668 0.4388 -0.0005324 0.001228
fixed NA poly(age, 3, raw = TRUE)3 -0.00000398 0.000004923 -0.8085 3663 0.4189 -0.00001363 0.000005669
fixed NA male -0.01637 0.006179 -2.649 3684 0.008096 -0.02848 -0.004261
fixed NA sibling_count3 0.01284 0.01128 1.138 3235 0.2551 -0.00927 0.03496
fixed NA sibling_count4 0.01034 0.0116 0.8908 3132 0.3731 -0.01241 0.03308
fixed NA sibling_count5 0.03911 0.01258 3.108 2993 0.001902 0.01444 0.06377
fixed NA sibling_count>5 0.03291 0.01219 2.699 2967 0.006998 0.00901 0.05681
fixed NA birth_order_nonlinear2 -0.015 0.008375 -1.791 3394 0.07345 -0.03141 0.001419
fixed NA birth_order_nonlinear3 -0.01467 0.009754 -1.504 3481 0.1327 -0.03379 0.004447
fixed NA birth_order_nonlinear4 -0.007381 0.01154 -0.6394 3550 0.5226 -0.03001 0.01524
fixed NA birth_order_nonlinear5 -0.01601 0.01406 -1.138 3559 0.255 -0.04356 0.01155
fixed NA birth_order_nonlinear>5 -0.02288 0.01282 -1.785 3554 0.07439 -0.04802 0.002247
ran_pars mother_pidlink sd__(Intercept) 0.03209 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1824 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1241 0.1221 1.016 3662 0.3096 -0.1153 0.3635
fixed NA poly(age, 3, raw = TRUE)1 -0.009842 0.01311 -0.7506 3660 0.453 -0.03554 0.01586
fixed NA poly(age, 3, raw = TRUE)2 0.000332 0.0004494 0.7389 3656 0.46 -0.0005487 0.001213
fixed NA poly(age, 3, raw = TRUE)3 -0.000003868 0.000004927 -0.785 3650 0.4325 -0.00001353 0.000005789
fixed NA male -0.01598 0.006177 -2.587 3674 0.00971 -0.02809 -0.003875
fixed NA count_birth_order2/2 0.0135 0.01767 0.7641 3428 0.4449 -0.02113 0.04813
fixed NA count_birth_order1/3 0.01416 0.0148 0.9565 3673 0.3389 -0.01486 0.04317
fixed NA count_birth_order2/3 0.00501 0.01613 0.3106 3674 0.7561 -0.0266 0.03662
fixed NA count_birth_order3/3 0.0268 0.01788 1.499 3674 0.134 -0.00825 0.06186
fixed NA count_birth_order1/4 0.04209 0.01607 2.62 3673 0.008829 0.0106 0.07358
fixed NA count_birth_order2/4 0.001262 0.01694 0.07454 3674 0.9406 -0.03193 0.03445
fixed NA count_birth_order3/4 -0.01579 0.01834 -0.861 3674 0.3893 -0.05173 0.02015
fixed NA count_birth_order4/4 0.001377 0.01992 0.06911 3674 0.9449 -0.03767 0.04042
fixed NA count_birth_order1/5 0.01152 0.01943 0.5932 3674 0.5531 -0.02655 0.0496
fixed NA count_birth_order2/5 0.04278 0.01992 2.147 3674 0.03184 0.003731 0.08183
fixed NA count_birth_order3/5 0.05774 0.02051 2.816 3674 0.004893 0.01755 0.09793
fixed NA count_birth_order4/5 0.05098 0.02088 2.441 3673 0.01467 0.01005 0.0919
fixed NA count_birth_order5/5 0.03361 0.0212 1.585 3672 0.113 -0.007949 0.07517
fixed NA count_birth_order1/>5 0.0718 0.01752 4.099 3668 0.00004242 0.03746 0.1061
fixed NA count_birth_order2/>5 0.00797 0.01852 0.4303 3673 0.667 -0.02833 0.04427
fixed NA count_birth_order3/>5 0.01289 0.01785 0.7224 3674 0.4701 -0.02209 0.04787
fixed NA count_birth_order4/>5 0.03653 0.01734 2.106 3674 0.03524 0.00254 0.07052
fixed NA count_birth_order5/>5 0.02583 0.01837 1.406 3673 0.1599 -0.01018 0.06183
fixed NA count_birth_order>5/>5 0.01946 0.01378 1.412 3502 0.158 -0.007545 0.04646
ran_pars mother_pidlink sd__(Intercept) 0.03092 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1822 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -1965 -1897 993.5 -1987 NA NA NA
12 -1965 -1890 994.3 -1989 1.631 1 0.2015
16 -1961 -1861 996.3 -1993 3.928 4 0.4158
26 -1966 -1805 1009 -2018 25.91 10 0.003867

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1323 0.1239 1.068 3591 0.2857 -0.1105 0.375
fixed NA poly(age, 3, raw = TRUE)1 -0.009582 0.01331 -0.72 3590 0.4715 -0.03566 0.0165
fixed NA poly(age, 3, raw = TRUE)2 0.0003121 0.0004563 0.684 3587 0.494 -0.0005822 0.001206
fixed NA poly(age, 3, raw = TRUE)3 -0.000003541 0.000005007 -0.7072 3582 0.4795 -0.00001335 0.000006272
fixed NA male -0.01515 0.006261 -2.42 3601 0.01558 -0.02742 -0.002879
fixed NA sibling_count3 0.006555 0.009888 0.6629 3008 0.5074 -0.01283 0.02593
fixed NA sibling_count4 0.0103 0.01033 0.9976 2766 0.3186 -0.00994 0.03055
fixed NA sibling_count5 0.03153 0.01178 2.677 2297 0.007475 0.008448 0.05462
fixed NA sibling_count>5 0.02033 0.01 2.032 2269 0.04224 0.0007231 0.03993
ran_pars mother_pidlink sd__(Intercept) 0.03537 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.182 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1282 0.1239 1.035 3589 0.3006 -0.1145 0.371
fixed NA birth_order -0.002884 0.001964 -1.469 3298 0.142 -0.006734 0.0009649
fixed NA poly(age, 3, raw = TRUE)1 -0.008817 0.01331 -0.6622 3587 0.5079 -0.03491 0.01728
fixed NA poly(age, 3, raw = TRUE)2 0.0002926 0.0004564 0.6411 3584 0.5215 -0.0006019 0.001187
fixed NA poly(age, 3, raw = TRUE)3 -0.00000345 0.000005006 -0.6891 3580 0.4908 -0.00001326 0.000006362
fixed NA male -0.01511 0.00626 -2.414 3600 0.01585 -0.02738 -0.00284
fixed NA sibling_count3 0.008016 0.009934 0.8069 3012 0.4198 -0.01145 0.02749
fixed NA sibling_count4 0.01341 0.01054 1.272 2771 0.2035 -0.007251 0.03406
fixed NA sibling_count5 0.03653 0.01225 2.98 2330 0.002908 0.01251 0.06054
fixed NA sibling_count>5 0.0306 0.0122 2.508 2442 0.01221 0.006687 0.05452
ran_pars mother_pidlink sd__(Intercept) 0.03485 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1821 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.1321 0.124 1.066 3585 0.2867 -0.1109 0.3752
fixed NA poly(age, 3, raw = TRUE)1 -0.009326 0.01332 -0.7001 3584 0.4839 -0.03543 0.01678
fixed NA poly(age, 3, raw = TRUE)2 0.0003124 0.0004566 0.6841 3581 0.494 -0.0005826 0.001207
fixed NA poly(age, 3, raw = TRUE)3 -0.000003693 0.00000501 -0.7371 3576 0.4611 -0.00001351 0.000006127
fixed NA male -0.01529 0.006263 -2.441 3596 0.01471 -0.02756 -0.00301
fixed NA sibling_count3 0.008291 0.01015 0.8167 3103 0.4142 -0.01161 0.02819
fixed NA sibling_count4 0.0134 0.01095 1.224 2952 0.2211 -0.008063 0.03487
fixed NA sibling_count5 0.03807 0.01282 2.97 2591 0.003006 0.01295 0.06319
fixed NA sibling_count>5 0.03212 0.01257 2.556 2617 0.01065 0.007489 0.05675
fixed NA birth_order_nonlinear2 -0.01056 0.008247 -1.281 3267 0.2004 -0.02672 0.005602
fixed NA birth_order_nonlinear3 -0.007715 0.009724 -0.7933 3342 0.4276 -0.02677 0.01134
fixed NA birth_order_nonlinear4 -0.009011 0.0122 -0.7386 3412 0.4602 -0.03292 0.0149
fixed NA birth_order_nonlinear5 -0.02419 0.01504 -1.609 3411 0.1078 -0.05367 0.005283
fixed NA birth_order_nonlinear>5 -0.0218 0.01465 -1.488 3518 0.137 -0.05052 0.006923
ran_pars mother_pidlink sd__(Intercept) 0.03468 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1822 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.121 0.1244 0.9726 3574 0.3308 -0.1228 0.3649
fixed NA poly(age, 3, raw = TRUE)1 -0.008724 0.01337 -0.6525 3572 0.5141 -0.03493 0.01748
fixed NA poly(age, 3, raw = TRUE)2 0.0002937 0.0004585 0.6407 3568 0.5218 -0.0006049 0.001192
fixed NA poly(age, 3, raw = TRUE)3 -0.000003527 0.000005032 -0.7009 3563 0.4834 -0.00001339 0.000006335
fixed NA male -0.0155 0.006273 -2.471 3586 0.01351 -0.0278 -0.003207
fixed NA count_birth_order2/2 0.005899 0.01572 0.3752 3261 0.7076 -0.02492 0.03671
fixed NA count_birth_order1/3 0.01002 0.0132 0.7592 3585 0.4478 -0.01585 0.03588
fixed NA count_birth_order2/3 0.004641 0.01468 0.3161 3586 0.7519 -0.02413 0.03342
fixed NA count_birth_order3/3 0.01141 0.01582 0.721 3585 0.4709 -0.0196 0.04241
fixed NA count_birth_order1/4 0.02893 0.01549 1.868 3585 0.06189 -0.00143 0.05929
fixed NA count_birth_order2/4 0.01144 0.01628 0.7029 3586 0.4822 -0.02046 0.04335
fixed NA count_birth_order3/4 0.002006 0.0169 0.1187 3585 0.9055 -0.03111 0.03513
fixed NA count_birth_order4/4 0.0008381 0.01836 0.04565 3585 0.9636 -0.03515 0.03682
fixed NA count_birth_order1/5 0.04949 0.02025 2.443 3585 0.0146 0.00979 0.08918
fixed NA count_birth_order2/5 0.02977 0.02263 1.316 3586 0.1884 -0.01458 0.07413
fixed NA count_birth_order3/5 0.04936 0.02207 2.236 3585 0.02539 0.006101 0.09262
fixed NA count_birth_order4/5 0.02171 0.02125 1.022 3584 0.307 -0.01994 0.06335
fixed NA count_birth_order5/5 0.01596 0.02257 0.7072 3583 0.4795 -0.02828 0.0602
fixed NA count_birth_order1/>5 0.04549 0.01974 2.305 3580 0.02123 0.006806 0.08417
fixed NA count_birth_order2/>5 0.001633 0.01997 0.08179 3585 0.9348 -0.0375 0.04076
fixed NA count_birth_order3/>5 0.02498 0.01907 1.31 3586 0.1903 -0.01239 0.06234
fixed NA count_birth_order4/>5 0.04811 0.01915 2.512 3585 0.01205 0.01057 0.08566
fixed NA count_birth_order5/>5 0.01544 0.01798 0.8588 3585 0.3905 -0.0198 0.05069
fixed NA count_birth_order>5/>5 0.01582 0.0139 1.138 3299 0.2552 -0.01143 0.04307
ran_pars mother_pidlink sd__(Intercept) 0.03447 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.1823 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 -1911 -1843 966.6 -1933 NA NA NA
12 -1911 -1837 967.7 -1935 2.166 1 0.1411
16 -1905 -1806 968.7 -1937 1.891 4 0.7558
26 -1893 -1732 972.6 -1945 7.916 10 0.637

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Smoking Behaviour

ever_smoked

birthorder <- birthorder %>% mutate(outcome = ever_smoked)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.03 0.0503 -20.47 14536 7.361e-92 -1.128 -0.9312
fixed NA poly(age, 3, raw = TRUE)1 0.08253 0.004782 17.26 14464 4.481e-66 0.07316 0.0919
fixed NA poly(age, 3, raw = TRUE)2 -0.001978 0.0001393 -14.2 14316 1.824e-45 -0.002251 -0.001705
fixed NA poly(age, 3, raw = TRUE)3 0.00001503 0.000001267 11.86 14149 2.761e-32 0.00001255 0.00001751
fixed NA male 0.6583 0.005408 121.7 14448 0 0.6477 0.6689
fixed NA sibling_count3 -0.01002 0.01094 -0.9159 10423 0.3597 -0.03148 0.01143
fixed NA sibling_count4 -0.001492 0.01126 -0.1325 9429 0.8946 -0.02357 0.02058
fixed NA sibling_count5 0.01039 0.01177 0.8824 8451 0.3776 -0.01268 0.03345
fixed NA sibling_count>5 0.01886 0.009216 2.047 9579 0.04069 0.0008013 0.03693
ran_pars mother_pidlink sd__(Intercept) 0.1122 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.311 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.03 0.0503 -20.48 14537 6.656e-92 -1.129 -0.9315
fixed NA birth_order -0.0009195 0.001144 -0.8039 12993 0.4215 -0.003161 0.001322
fixed NA poly(age, 3, raw = TRUE)1 0.0828 0.004794 17.27 14453 3.558e-66 0.0734 0.09219
fixed NA poly(age, 3, raw = TRUE)2 -0.001988 0.0001398 -14.22 14261 1.463e-45 -0.002262 -0.001714
fixed NA poly(age, 3, raw = TRUE)3 0.00001512 0.000001272 11.88 14068 2.065e-32 0.00001263 0.00001761
fixed NA male 0.6583 0.005408 121.7 14447 0 0.6477 0.6689
fixed NA sibling_count3 -0.009801 0.01095 -0.8952 10442 0.3707 -0.03126 0.01166
fixed NA sibling_count4 -0.0008537 0.01129 -0.07562 9502 0.9397 -0.02298 0.02127
fixed NA sibling_count5 0.01149 0.01185 0.9696 8573 0.3323 -0.01173 0.03471
fixed NA sibling_count>5 0.02234 0.01018 2.195 10757 0.02821 0.002388 0.04229
ran_pars mother_pidlink sd__(Intercept) 0.1122 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.311 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.035 0.05044 -20.52 14539 2.673e-92 -1.134 -0.9364
fixed NA poly(age, 3, raw = TRUE)1 0.08307 0.004796 17.32 14460 1.516e-66 0.07367 0.09247
fixed NA poly(age, 3, raw = TRUE)2 -0.001998 0.0001399 -14.29 14270 5.403e-46 -0.002272 -0.001724
fixed NA poly(age, 3, raw = TRUE)3 0.00001522 0.000001273 11.96 14066 8.39e-33 0.00001273 0.00001772
fixed NA male 0.6584 0.005408 121.7 14443 0 0.6478 0.669
fixed NA sibling_count3 -0.008598 0.0111 -0.7743 10829 0.4388 -0.03036 0.01317
fixed NA sibling_count4 -0.000003608 0.01161 -0.0003108 10265 0.9998 -0.02276 0.02275
fixed NA sibling_count5 0.01432 0.0123 1.164 9553 0.2443 -0.009785 0.03844
fixed NA sibling_count>5 0.02736 0.01069 2.558 11943 0.01054 0.006396 0.04832
fixed NA birth_order_nonlinear2 0.006211 0.007852 0.791 13189 0.4289 -0.009178 0.0216
fixed NA birth_order_nonlinear3 -0.005846 0.009241 -0.6326 12978 0.527 -0.02396 0.01227
fixed NA birth_order_nonlinear4 0.0003569 0.01056 0.0338 13112 0.973 -0.02034 0.02105
fixed NA birth_order_nonlinear5 -0.01352 0.01202 -1.125 13128 0.2608 -0.03708 0.01004
fixed NA birth_order_nonlinear>5 -0.01148 0.009959 -1.153 14660 0.249 -0.031 0.008039
ran_pars mother_pidlink sd__(Intercept) 0.1122 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.311 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.041 0.05065 -20.55 14538 1.64e-92 -1.14 -0.9414
fixed NA poly(age, 3, raw = TRUE)1 0.08302 0.004795 17.31 14451 1.774e-66 0.07362 0.09242
fixed NA poly(age, 3, raw = TRUE)2 -0.002001 0.0001399 -14.31 14255 3.99e-46 -0.002275 -0.001727
fixed NA poly(age, 3, raw = TRUE)3 0.00001528 0.000001273 12.01 14043 4.727e-33 0.00001279 0.00001778
fixed NA male 0.6581 0.005408 121.7 14434 0 0.6475 0.6687
fixed NA count_birth_order2/2 0.02629 0.01527 1.722 13066 0.08507 -0.003631 0.05621
fixed NA count_birth_order1/3 -0.01405 0.0145 -0.9691 14488 0.3325 -0.04248 0.01437
fixed NA count_birth_order2/3 0.01445 0.01621 0.8916 14567 0.3726 -0.01732 0.04623
fixed NA count_birth_order3/3 0.00651 0.01806 0.3604 14630 0.7186 -0.0289 0.04192
fixed NA count_birth_order1/4 0.01338 0.01641 0.8149 14572 0.4151 -0.01879 0.04555
fixed NA count_birth_order2/4 0.006355 0.01745 0.3641 14605 0.7158 -0.02785 0.04056
fixed NA count_birth_order3/4 -0.001847 0.01893 -0.09757 14645 0.9223 -0.03895 0.03526
fixed NA count_birth_order4/4 0.01231 0.01984 0.6205 14658 0.535 -0.02658 0.0512
fixed NA count_birth_order1/5 0.03854 0.01879 2.051 14632 0.0403 0.001707 0.07537
fixed NA count_birth_order2/5 0.005322 0.01985 0.2681 14656 0.7886 -0.03359 0.04423
fixed NA count_birth_order3/5 0.003385 0.02026 0.167 14661 0.8673 -0.03633 0.0431
fixed NA count_birth_order4/5 0.05807 0.0217 2.676 14670 0.007462 0.01554 0.1006
fixed NA count_birth_order5/5 -0.008625 0.02211 -0.3901 14670 0.6964 -0.05196 0.03471
fixed NA count_birth_order1/>5 0.04767 0.01512 3.152 14665 0.001622 0.01803 0.0773
fixed NA count_birth_order2/>5 0.03767 0.01564 2.409 14670 0.01603 0.007016 0.06833
fixed NA count_birth_order3/>5 0.02911 0.01529 1.903 14670 0.057 -0.0008641 0.05908
fixed NA count_birth_order4/>5 0.0213 0.01504 1.417 14670 0.1566 -0.008173 0.05078
fixed NA count_birth_order5/>5 0.02724 0.01511 1.802 14670 0.07149 -0.00238 0.05687
fixed NA count_birth_order>5/>5 0.02345 0.01185 1.979 13115 0.04789 0.0002202 0.04667
ran_pars mother_pidlink sd__(Intercept) 0.1121 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.311 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 9037 9120 -4507 9015 NA NA NA
12 9038 9129 -4507 9014 0.6469 1 0.4212
16 9042 9164 -4505 9010 3.709 4 0.4468
26 9046 9244 -4497 8994 16.27 10 0.09213

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.811 0.1473 -12.3 6155 2.244e-34 -2.1 -1.523
fixed NA poly(age, 3, raw = TRUE)1 0.175 0.01672 10.47 6159 2.005e-25 0.1423 0.2078
fixed NA poly(age, 3, raw = TRUE)2 -0.005302 0.0005975 -8.873 6165 9.192e-19 -0.006473 -0.004131
fixed NA poly(age, 3, raw = TRUE)3 0.00005222 0.000006778 7.704 6172 1.527e-14 0.00003893 0.0000655
fixed NA male 0.5873 0.008561 68.6 6083 0 0.5705 0.6041
fixed NA sibling_count3 0.007451 0.0136 0.5479 4527 0.5838 -0.0192 0.03411
fixed NA sibling_count4 0.004702 0.01467 0.3206 4014 0.7486 -0.02405 0.03345
fixed NA sibling_count5 0.03346 0.01688 1.982 3606 0.04754 0.0003739 0.06655
fixed NA sibling_count>5 0.0422 0.01476 2.859 3391 0.004274 0.01327 0.07113
ran_pars mother_pidlink sd__(Intercept) 0.135 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3135 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.811 0.1473 -12.29 6154 2.438e-34 -2.1 -1.522
fixed NA birth_order -0.0006785 0.002855 -0.2377 6160 0.8122 -0.006274 0.004917
fixed NA poly(age, 3, raw = TRUE)1 0.1751 0.01672 10.47 6159 1.991e-25 0.1423 0.2078
fixed NA poly(age, 3, raw = TRUE)2 -0.005302 0.0005976 -8.872 6164 9.248e-19 -0.006473 -0.004131
fixed NA poly(age, 3, raw = TRUE)3 0.00005219 0.000006779 7.698 6169 1.596e-14 0.0000389 0.00006548
fixed NA male 0.5873 0.008562 68.59 6082 0 0.5705 0.6041
fixed NA sibling_count3 0.007791 0.01368 0.5697 4532 0.5689 -0.01901 0.0346
fixed NA sibling_count4 0.005488 0.01504 0.365 4024 0.7152 -0.02398 0.03496
fixed NA sibling_count5 0.03474 0.01772 1.96 3697 0.05003 0.000007231 0.06947
fixed NA sibling_count>5 0.04478 0.01832 2.445 3922 0.01454 0.008878 0.08068
ran_pars mother_pidlink sd__(Intercept) 0.135 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3135 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.823 0.1476 -12.35 6162 1.218e-34 -2.113 -1.534
fixed NA poly(age, 3, raw = TRUE)1 0.1759 0.01674 10.5 6162 1.354e-25 0.1431 0.2087
fixed NA poly(age, 3, raw = TRUE)2 -0.005327 0.0005982 -8.905 6165 6.916e-19 -0.0065 -0.004155
fixed NA poly(age, 3, raw = TRUE)3 0.00005238 0.000006787 7.718 6169 1.369e-14 0.00003908 0.00006568
fixed NA male 0.5875 0.008564 68.6 6077 0 0.5707 0.6043
fixed NA sibling_count3 0.006373 0.01395 0.4567 4729 0.6479 -0.02098 0.03372
fixed NA sibling_count4 0.005122 0.01561 0.3282 4367 0.7428 -0.02547 0.03571
fixed NA sibling_count5 0.03905 0.01858 2.102 4148 0.03561 0.002639 0.07546
fixed NA sibling_count>5 0.05275 0.01885 2.798 4185 0.005173 0.01579 0.0897
fixed NA birth_order_nonlinear2 0.01327 0.01101 1.205 5114 0.2282 -0.008314 0.03486
fixed NA birth_order_nonlinear3 0.005947 0.01359 0.4377 5359 0.6616 -0.02069 0.03258
fixed NA birth_order_nonlinear4 -0.002039 0.01687 -0.1209 5538 0.9038 -0.0351 0.03103
fixed NA birth_order_nonlinear5 -0.0184 0.02114 -0.8704 5387 0.3841 -0.05983 0.02303
fixed NA birth_order_nonlinear>5 -0.01167 0.02127 -0.5488 6193 0.5832 -0.05335 0.03001
ran_pars mother_pidlink sd__(Intercept) 0.1349 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3136 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.824 0.1479 -12.33 6156 1.65e-34 -2.114 -1.534
fixed NA poly(age, 3, raw = TRUE)1 0.175 0.01678 10.43 6154 2.86e-25 0.1421 0.2079
fixed NA poly(age, 3, raw = TRUE)2 -0.005298 0.0005996 -8.836 6158 1.271e-18 -0.006473 -0.004123
fixed NA poly(age, 3, raw = TRUE)3 0.00005206 0.000006804 7.651 6162 2.293e-14 0.00003872 0.0000654
fixed NA male 0.5874 0.008572 68.52 6067 0 0.5706 0.6042
fixed NA count_birth_order2/2 0.03734 0.01984 1.882 5368 0.05993 -0.001552 0.07623
fixed NA count_birth_order1/3 0.02279 0.01783 1.278 6153 0.2012 -0.01215 0.05772
fixed NA count_birth_order2/3 0.01879 0.01937 0.9702 6189 0.332 -0.01917 0.05676
fixed NA count_birth_order3/3 0.01655 0.02162 0.7655 6202 0.444 -0.02582 0.05892
fixed NA count_birth_order1/4 0.006185 0.0217 0.285 6184 0.7756 -0.03634 0.04871
fixed NA count_birth_order2/4 0.0236 0.02242 1.053 6201 0.2924 -0.02033 0.06754
fixed NA count_birth_order3/4 0.03506 0.02373 1.477 6197 0.1397 -0.01146 0.08157
fixed NA count_birth_order4/4 0.007861 0.02467 0.3187 6194 0.75 -0.04048 0.0562
fixed NA count_birth_order1/5 0.03545 0.0295 1.202 6202 0.2295 -0.02237 0.09326
fixed NA count_birth_order2/5 0.06082 0.0317 1.918 6173 0.05511 -0.00132 0.123
fixed NA count_birth_order3/5 0.05973 0.02949 2.026 6181 0.04284 0.001939 0.1175
fixed NA count_birth_order4/5 0.04242 0.02892 1.467 6188 0.1424 -0.01426 0.09909
fixed NA count_birth_order5/5 0.03742 0.02999 1.248 6173 0.2122 -0.02136 0.0962
fixed NA count_birth_order1/>5 0.09227 0.0293 3.149 6190 0.001644 0.03485 0.1497
fixed NA count_birth_order2/>5 0.06653 0.02937 2.265 6172 0.02353 0.008968 0.1241
fixed NA count_birth_order3/>5 0.04338 0.02873 1.51 6153 0.1311 -0.01293 0.09969
fixed NA count_birth_order4/>5 0.06546 0.02705 2.42 6153 0.01554 0.01245 0.1185
fixed NA count_birth_order5/>5 0.03659 0.02583 1.417 6155 0.1566 -0.01403 0.08721
fixed NA count_birth_order>5/>5 0.04926 0.01961 2.512 5699 0.01203 0.01083 0.0877
ran_pars mother_pidlink sd__(Intercept) 0.1344 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3139 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 4222 4296 -2100 4200 NA NA NA
12 4224 4304 -2100 4200 0.05593 1 0.813
16 4228 4336 -2098 4196 3.26 4 0.5153
26 4242 4417 -2095 4190 6.288 10 0.7905

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.794 0.1469 -12.21 6212 6.652e-34 -2.081 -1.506
fixed NA poly(age, 3, raw = TRUE)1 0.1732 0.01669 10.38 6215 5.046e-25 0.1405 0.2059
fixed NA poly(age, 3, raw = TRUE)2 -0.005237 0.0005964 -8.78 6221 2.085e-18 -0.006406 -0.004068
fixed NA poly(age, 3, raw = TRUE)3 0.00005152 0.000006767 7.614 6228 3.051e-14 0.00003826 0.00006479
fixed NA male 0.5869 0.008534 68.77 6136 0 0.5702 0.6036
fixed NA sibling_count3 0.008936 0.01474 0.6065 4703 0.5442 -0.01994 0.03782
fixed NA sibling_count4 -0.001759 0.01552 -0.1134 4287 0.9098 -0.03218 0.02866
fixed NA sibling_count5 0.02235 0.0167 1.338 3903 0.1809 -0.01038 0.05507
fixed NA sibling_count>5 0.0372 0.01461 2.547 3995 0.01091 0.008571 0.06583
ran_pars mother_pidlink sd__(Intercept) 0.1351 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3138 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.794 0.1469 -12.21 6211 6.894e-34 -2.082 -1.506
fixed NA birth_order 0.00006028 0.002496 0.02415 6060 0.9807 -0.004833 0.004953
fixed NA poly(age, 3, raw = TRUE)1 0.1732 0.01669 10.38 6214 5.09e-25 0.1405 0.2059
fixed NA poly(age, 3, raw = TRUE)2 -0.005237 0.0005965 -8.779 6219 2.097e-18 -0.006406 -0.004068
fixed NA poly(age, 3, raw = TRUE)3 0.00005153 0.000006769 7.612 6226 3.089e-14 0.00003826 0.00006479
fixed NA male 0.5869 0.008535 68.77 6136 0 0.5702 0.6036
fixed NA sibling_count3 0.008906 0.01479 0.6023 4702 0.547 -0.02008 0.03789
fixed NA sibling_count4 -0.001826 0.01577 -0.1158 4276 0.9078 -0.03273 0.02907
fixed NA sibling_count5 0.02224 0.01726 1.289 3920 0.1975 -0.01158 0.05606
fixed NA sibling_count>5 0.03698 0.01725 2.144 4304 0.03212 0.003169 0.07079
ran_pars mother_pidlink sd__(Intercept) 0.1351 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3138 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.805 0.1472 -12.26 6217 3.554e-34 -2.094 -1.517
fixed NA poly(age, 3, raw = TRUE)1 0.1739 0.0167 10.41 6216 3.463e-25 0.1412 0.2067
fixed NA poly(age, 3, raw = TRUE)2 -0.005261 0.000597 -8.812 6219 1.579e-18 -0.006431 -0.004091
fixed NA poly(age, 3, raw = TRUE)3 0.00005171 0.000006775 7.631 6224 2.67e-14 0.00003843 0.00006499
fixed NA male 0.5871 0.008536 68.78 6129 0 0.5704 0.6038
fixed NA sibling_count3 0.009283 0.01506 0.6165 4865 0.5376 -0.02023 0.0388
fixed NA sibling_count4 -0.001904 0.01631 -0.1168 4570 0.907 -0.03386 0.03005
fixed NA sibling_count5 0.02286 0.01805 1.267 4314 0.2053 -0.01251 0.05823
fixed NA sibling_count>5 0.04524 0.01778 2.545 4581 0.01097 0.0104 0.08008
fixed NA birth_order_nonlinear2 0.01394 0.01123 1.241 5253 0.2145 -0.008069 0.03595
fixed NA birth_order_nonlinear3 -0.0001939 0.01354 -0.01432 5491 0.9886 -0.02674 0.02635
fixed NA birth_order_nonlinear4 0.006623 0.01636 0.4047 5679 0.6857 -0.02545 0.0387
fixed NA birth_order_nonlinear5 0.004426 0.02007 0.2205 5610 0.8255 -0.03492 0.04377
fixed NA birth_order_nonlinear>5 -0.01611 0.01903 -0.8463 6268 0.3974 -0.05342 0.0212
ran_pars mother_pidlink sd__(Intercept) 0.1356 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3136 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.817 0.1475 -12.31 6212 1.901e-34 -2.106 -1.528
fixed NA poly(age, 3, raw = TRUE)1 0.1742 0.01673 10.41 6208 3.549e-25 0.1414 0.207
fixed NA poly(age, 3, raw = TRUE)2 -0.005268 0.0005982 -8.807 6212 1.644e-18 -0.00644 -0.004096
fixed NA poly(age, 3, raw = TRUE)3 0.00005175 0.000006789 7.623 6218 2.855e-14 0.00003845 0.00006506
fixed NA male 0.5867 0.008543 68.68 6120 0 0.57 0.6035
fixed NA count_birth_order2/2 0.04181 0.0218 1.918 5523 0.05513 -0.0009097 0.08454
fixed NA count_birth_order1/3 0.0185 0.01933 0.9574 6209 0.3384 -0.01937 0.05638
fixed NA count_birth_order2/3 0.0225 0.02097 1.073 6244 0.2832 -0.01859 0.0636
fixed NA count_birth_order3/3 0.03344 0.02342 1.428 6258 0.1534 -0.01246 0.07935
fixed NA count_birth_order1/4 0.0112 0.0227 0.4936 6239 0.6216 -0.03328 0.05569
fixed NA count_birth_order2/4 0.03426 0.02315 1.48 6254 0.1389 -0.0111 0.07963
fixed NA count_birth_order3/4 -0.0004727 0.02537 -0.01863 6253 0.9851 -0.05019 0.04925
fixed NA count_birth_order4/4 -0.00158 0.02624 -0.06022 6252 0.952 -0.05301 0.04985
fixed NA count_birth_order1/5 0.05073 0.02702 1.877 6256 0.06051 -0.00223 0.1037
fixed NA count_birth_order2/5 0.03313 0.02898 1.143 6247 0.2531 -0.02368 0.08994
fixed NA count_birth_order3/5 0.0241 0.02834 0.8502 6246 0.3952 -0.03145 0.07964
fixed NA count_birth_order4/5 0.03857 0.02958 1.304 6231 0.1924 -0.01941 0.09654
fixed NA count_birth_order5/5 0.03566 0.02946 1.211 6233 0.2261 -0.02207 0.09339
fixed NA count_birth_order1/>5 0.06043 0.02573 2.348 6258 0.01889 0.009995 0.1109
fixed NA count_birth_order2/>5 0.05178 0.02694 1.922 6241 0.05471 -0.001035 0.1046
fixed NA count_birth_order3/>5 0.04945 0.02611 1.894 6231 0.05832 -0.001733 0.1006
fixed NA count_birth_order4/>5 0.07459 0.02516 2.965 6231 0.003038 0.02528 0.1239
fixed NA count_birth_order5/>5 0.05976 0.02593 2.305 6198 0.02122 0.00894 0.1106
fixed NA count_birth_order>5/>5 0.03856 0.01928 2.001 5828 0.04548 0.0007835 0.07634
ran_pars mother_pidlink sd__(Intercept) 0.1352 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3139 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 4271 4345 -2124 4249 NA NA NA
12 4273 4354 -2124 4249 0.0006262 1 0.98
16 4277 4385 -2123 4245 3.427 4 0.489
26 4291 4467 -2120 4239 6.031 10 0.8126

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.855 0.1489 -12.46 6036 3.362e-35 -2.147 -1.564
fixed NA poly(age, 3, raw = TRUE)1 0.1807 0.01692 10.68 6040 2.16e-26 0.1475 0.2139
fixed NA poly(age, 3, raw = TRUE)2 -0.005507 0.0006047 -9.107 6044 1.135e-19 -0.006692 -0.004322
fixed NA poly(age, 3, raw = TRUE)3 0.0000546 0.000006863 7.955 6051 2.117e-15 0.00004115 0.00006805
fixed NA male 0.5873 0.008645 67.94 5964 0 0.5704 0.6042
fixed NA sibling_count3 0.002991 0.01342 0.2229 4438 0.8236 -0.02331 0.02929
fixed NA sibling_count4 -0.001225 0.01458 -0.08399 3942 0.9331 -0.0298 0.02735
fixed NA sibling_count5 0.01576 0.01729 0.9113 3439 0.3622 -0.01813 0.04964
fixed NA sibling_count>5 0.03472 0.01492 2.327 3242 0.02001 0.00548 0.06395
ran_pars mother_pidlink sd__(Intercept) 0.1349 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3134 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.855 0.1489 -12.46 6035 3.47e-35 -2.147 -1.563
fixed NA birth_order -0.000005794 0.002939 -0.001972 6064 0.9984 -0.005766 0.005754
fixed NA poly(age, 3, raw = TRUE)1 0.1807 0.01692 10.68 6039 2.189e-26 0.1475 0.2139
fixed NA poly(age, 3, raw = TRUE)2 -0.005507 0.0006048 -9.106 6043 1.143e-19 -0.006692 -0.004322
fixed NA poly(age, 3, raw = TRUE)3 0.0000546 0.000006865 7.954 6049 2.146e-15 0.00004114 0.00006805
fixed NA male 0.5873 0.008646 67.93 5963 0 0.5704 0.6042
fixed NA sibling_count3 0.002994 0.0135 0.2218 4441 0.8245 -0.02347 0.02946
fixed NA sibling_count4 -0.001218 0.01496 -0.08141 3964 0.9351 -0.03054 0.0281
fixed NA sibling_count5 0.01577 0.01809 0.8717 3528 0.3834 -0.01968 0.05122
fixed NA sibling_count>5 0.03474 0.01857 1.871 3867 0.06141 -0.00165 0.07113
ran_pars mother_pidlink sd__(Intercept) 0.1349 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3134 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.869 0.1492 -12.53 6042 1.497e-35 -2.162 -1.577
fixed NA poly(age, 3, raw = TRUE)1 0.1817 0.01694 10.73 6042 1.312e-26 0.1485 0.2149
fixed NA poly(age, 3, raw = TRUE)2 -0.005537 0.0006053 -9.147 6044 7.824e-20 -0.006723 -0.004351
fixed NA poly(age, 3, raw = TRUE)3 0.00005483 0.000006871 7.979 6048 1.751e-15 0.00004136 0.00006829
fixed NA male 0.5875 0.008647 67.94 5958 0 0.5705 0.6044
fixed NA sibling_count3 0.001975 0.01379 0.1433 4637 0.8861 -0.02505 0.029
fixed NA sibling_count4 -0.0008761 0.01555 -0.05635 4304 0.9551 -0.03135 0.0296
fixed NA sibling_count5 0.02003 0.01889 1.06 3933 0.2891 -0.017 0.05706
fixed NA sibling_count>5 0.04395 0.01914 2.296 4145 0.0217 0.006439 0.08146
fixed NA birth_order_nonlinear2 0.01494 0.01099 1.36 5001 0.1739 -0.006592 0.03647
fixed NA birth_order_nonlinear3 0.006761 0.01359 0.4976 5226 0.6188 -0.01987 0.03339
fixed NA birth_order_nonlinear4 -0.002179 0.01735 -0.1256 5394 0.9001 -0.03619 0.03183
fixed NA birth_order_nonlinear5 -0.01151 0.022 -0.5233 5266 0.6008 -0.05462 0.0316
fixed NA birth_order_nonlinear>5 -0.01037 0.02192 -0.4732 6052 0.6361 -0.05333 0.03259
ran_pars mother_pidlink sd__(Intercept) 0.135 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3134 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -1.866 0.1496 -12.47 6037 2.893e-35 -2.159 -1.573
fixed NA poly(age, 3, raw = TRUE)1 0.1803 0.01697 10.62 6035 4.043e-26 0.147 0.2136
fixed NA poly(age, 3, raw = TRUE)2 -0.005484 0.0006068 -9.037 6038 2.137e-19 -0.006673 -0.004294
fixed NA poly(age, 3, raw = TRUE)3 0.00005418 0.00000689 7.864 6043 4.359e-15 0.00004068 0.00006769
fixed NA male 0.5871 0.008655 67.84 5947 0 0.5702 0.6041
fixed NA count_birth_order2/2 0.03855 0.01928 2 5203 0.04559 0.0007658 0.07634
fixed NA count_birth_order1/3 0.01712 0.0176 0.973 6032 0.3306 -0.01737 0.05162
fixed NA count_birth_order2/3 0.01647 0.01936 0.8508 6073 0.3949 -0.02147 0.05442
fixed NA count_birth_order3/3 0.01444 0.02124 0.6799 6080 0.4966 -0.02719 0.05608
fixed NA count_birth_order1/4 -0.006943 0.02179 -0.3187 6068 0.75 -0.04964 0.03576
fixed NA count_birth_order2/4 0.02816 0.02244 1.255 6080 0.2096 -0.01583 0.07215
fixed NA count_birth_order3/4 0.02373 0.02352 1.009 6073 0.3129 -0.02236 0.06982
fixed NA count_birth_order4/4 0.006673 0.02483 0.2687 6066 0.7882 -0.042 0.05534
fixed NA count_birth_order1/5 0.03185 0.0295 1.08 6080 0.2803 -0.02596 0.08967
fixed NA count_birth_order2/5 0.02865 0.03271 0.876 6046 0.381 -0.03545 0.09276
fixed NA count_birth_order3/5 0.03949 0.03081 1.282 6053 0.2 -0.02089 0.09986
fixed NA count_birth_order4/5 0.01282 0.03022 0.4241 6061 0.6715 -0.04641 0.07204
fixed NA count_birth_order5/5 0.03525 0.03195 1.103 6043 0.2699 -0.02737 0.09787
fixed NA count_birth_order1/>5 0.09172 0.03002 3.055 6063 0.002259 0.03288 0.1506
fixed NA count_birth_order2/>5 0.04846 0.0301 1.61 6045 0.1075 -0.01054 0.1075
fixed NA count_birth_order3/>5 0.04365 0.02902 1.504 6030 0.1326 -0.01323 0.1005
fixed NA count_birth_order4/>5 0.05895 0.02846 2.071 6003 0.03836 0.003172 0.1147
fixed NA count_birth_order5/>5 0.02874 0.0264 1.089 6027 0.2763 -0.023 0.08049
fixed NA count_birth_order>5/>5 0.04156 0.01996 2.082 5549 0.03742 0.002429 0.08069
ran_pars mother_pidlink sd__(Intercept) 0.1344 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.3137 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 4133 4207 -2056 4111 NA NA NA
12 4135 4216 -2056 4111 0.0000002846 1 0.9996
16 4140 4248 -2054 4108 3.094 4 0.5423
26 4153 4327 -2050 4101 7.745 10 0.6537

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

still_smoking

birthorder <- birthorder %>% mutate(outcome = still_smoking)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
                   data = birthorder)
compare_birthorder_specs(model)

Naive birth order

outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_naive_factor,
                            birth_order_nonlinear = birthorder_naive_factor,
                            birth_order = birthorder_naive,
                            count_birth_order = count_birthorder_naive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4994 0.07927 6.299 4830 0.0000000003255 0.344 0.6547
fixed NA poly(age, 3, raw = TRUE)1 0.02068 0.006708 3.082 4717 0.002065 0.00753 0.03383
fixed NA poly(age, 3, raw = TRUE)2 -0.0005941 0.0001832 -3.243 4556 0.00119 -0.0009531 -0.0002351
fixed NA poly(age, 3, raw = TRUE)3 0.000004817 0.000001566 3.076 4346 0.00211 0.000001748 0.000007886
fixed NA male 0.2089 0.02436 8.575 4962 1.302e-17 0.1611 0.2566
fixed NA sibling_count3 0.01578 0.01612 0.9789 4335 0.3277 -0.01581 0.04737
fixed NA sibling_count4 0.003225 0.01616 0.1996 4098 0.8418 -0.02844 0.03489
fixed NA sibling_count5 0.009782 0.01671 0.5853 3843 0.5583 -0.02297 0.04253
fixed NA sibling_count>5 0.0114 0.01314 0.8676 4225 0.3857 -0.01435 0.03715
ran_pars mother_pidlink sd__(Intercept) 0.03882 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2719 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4993 0.07928 6.297 4830 0.0000000003298 0.3439 0.6547
fixed NA birth_order -0.0001987 0.001539 -0.1291 4029 0.8973 -0.003215 0.002818
fixed NA poly(age, 3, raw = TRUE)1 0.02074 0.006724 3.084 4708 0.002055 0.007557 0.03391
fixed NA poly(age, 3, raw = TRUE)2 -0.000596 0.0001838 -3.243 4529 0.001192 -0.0009562 -0.0002358
fixed NA poly(age, 3, raw = TRUE)3 0.000004833 0.000001571 3.076 4310 0.00211 0.000001754 0.000007912
fixed NA male 0.2089 0.02436 8.575 4961 1.306e-17 0.1612 0.2566
fixed NA sibling_count3 0.01584 0.01613 0.9821 4338 0.3261 -0.01577 0.04745
fixed NA sibling_count4 0.003347 0.01619 0.2068 4110 0.8362 -0.02838 0.03507
fixed NA sibling_count5 0.009997 0.0168 0.5952 3868 0.5517 -0.02292 0.04292
fixed NA sibling_count>5 0.01211 0.01424 0.85 4440 0.3954 -0.01581 0.04002
ran_pars mother_pidlink sd__(Intercept) 0.03895 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2719 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.4961 0.07939 6.249 4829 0.0000000004489 0.3405 0.6517
fixed NA poly(age, 3, raw = TRUE)1 0.02088 0.006727 3.104 4712 0.00192 0.007696 0.03406
fixed NA poly(age, 3, raw = TRUE)2 -0.0005984 0.0001838 -3.256 4539 0.001138 -0.0009587 -0.0002382
fixed NA poly(age, 3, raw = TRUE)3 0.000004839 0.000001571 3.081 4320 0.002075 0.000001761 0.000007918
fixed NA male 0.2098 0.02437 8.608 4956 9.817e-18 0.162 0.2575
fixed NA sibling_count3 0.02091 0.01643 1.272 4435 0.2033 -0.0113 0.05311
fixed NA sibling_count4 0.005396 0.01667 0.3237 4263 0.7462 -0.02728 0.03807
fixed NA sibling_count5 0.01371 0.01745 0.7858 4106 0.4321 -0.02049 0.04792
fixed NA sibling_count>5 0.01531 0.01499 1.021 4640 0.3071 -0.01407 0.0447
fixed NA birth_order_nonlinear2 0.00008096 0.01166 0.006942 4775 0.9945 -0.02278 0.02294
fixed NA birth_order_nonlinear3 -0.01968 0.01347 -1.462 4766 0.1439 -0.04608 0.006712
fixed NA birth_order_nonlinear4 0.009552 0.01505 0.6349 4843 0.5255 -0.01994 0.03904
fixed NA birth_order_nonlinear5 -0.01544 0.01716 -0.8998 4879 0.3683 -0.04908 0.01819
fixed NA birth_order_nonlinear>5 -0.002691 0.01378 -0.1952 4922 0.8452 -0.02971 0.02432
ran_pars mother_pidlink sd__(Intercept) 0.03821 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.272 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) 0.493 0.07968 6.187 4830 0.0000000006637 0.3368 0.6491
fixed NA poly(age, 3, raw = TRUE)1 0.02063 0.006731 3.065 4707 0.002188 0.007438 0.03382
fixed NA poly(age, 3, raw = TRUE)2 -0.0005914 0.0001838 -3.217 4534 0.001303 -0.0009517 -0.0002311
fixed NA poly(age, 3, raw = TRUE)3 0.000004788 0.00000157 3.049 4316 0.002313 0.00000171 0.000007866
fixed NA male 0.2092 0.02437 8.584 4946 1.209e-17 0.1614 0.2569
fixed NA count_birth_order2/2 0.01447 0.02335 0.6196 4660 0.5356 -0.0313 0.06024
fixed NA count_birth_order1/3 0.02399 0.02313 1.037 4966 0.2998 -0.02135 0.06933
fixed NA count_birth_order2/3 0.03065 0.0246 1.246 4967 0.2128 -0.01756 0.07886
fixed NA count_birth_order3/3 0.007198 0.02658 0.2708 4966 0.7865 -0.04489 0.05929
fixed NA count_birth_order1/4 0.0006132 0.0246 0.02493 4967 0.9801 -0.04759 0.04882
fixed NA count_birth_order2/4 0.008111 0.02642 0.307 4967 0.7589 -0.04368 0.0599
fixed NA count_birth_order3/4 -0.001621 0.02848 -0.05692 4967 0.9546 -0.05744 0.0542
fixed NA count_birth_order4/4 0.03651 0.02921 1.25 4965 0.2114 -0.02074 0.09375
fixed NA count_birth_order1/5 0.04653 0.0274 1.698 4967 0.08951 -0.007168 0.1002
fixed NA count_birth_order2/5 -0.02254 0.03016 -0.7475 4967 0.4548 -0.08165 0.03656
fixed NA count_birth_order3/5 -0.04164 0.03144 -1.324 4967 0.1854 -0.1033 0.01998
fixed NA count_birth_order4/5 0.02983 0.03076 0.9699 4967 0.3321 -0.03045 0.09012
fixed NA count_birth_order5/5 0.06484 0.03397 1.908 4967 0.05639 -0.001749 0.1314
fixed NA count_birth_order1/>5 0.02421 0.02135 1.134 4967 0.2568 -0.01763 0.06605
fixed NA count_birth_order2/>5 0.03074 0.02247 1.368 4967 0.1713 -0.0133 0.07477
fixed NA count_birth_order3/>5 0.01257 0.02201 0.5714 4967 0.5678 -0.03056 0.0557
fixed NA count_birth_order4/>5 0.02479 0.02202 1.126 4967 0.2603 -0.01837 0.06795
fixed NA count_birth_order5/>5 -0.01014 0.02209 -0.4591 4967 0.6462 -0.05344 0.03316
fixed NA count_birth_order>5/>5 0.01887 0.01779 1.06 4766 0.289 -0.016 0.05374
ran_pars mother_pidlink sd__(Intercept) 0.03823 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2719 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_naive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 1276 1348 -627.1 1254 NA NA NA
12 1278 1356 -627.1 1254 0.01671 1 0.8972
16 1282 1386 -624.8 1250 4.631 4 0.3273
26 1288 1457 -617.9 1236 13.77 10 0.1836

Maternal birth order

outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
                     mutate(sibling_count = sibling_count_uterus_alive_factor,
                            birth_order_nonlinear = birthorder_uterus_alive_factor,
                            birth_order = birthorder_uterus_alive,
                            count_birth_order = count_birthorder_uterus_alive) %>% 
                     filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.08365 0.2385 -0.3507 1859 0.7258 -0.5511 0.3838
fixed NA poly(age, 3, raw = TRUE)1 0.08334 0.02526 3.299 1859 0.0009875 0.03383 0.1328
fixed NA poly(age, 3, raw = TRUE)2 -0.002847 0.0008678 -3.281 1859 0.001055 -0.004548 -0.001146
fixed NA poly(age, 3, raw = TRUE)3 0.00003 0.000009506 3.156 1859 0.001628 0.00001136 0.00004863
fixed NA male 0.2353 0.04151 5.669 1859 0.00000001665 0.154 0.3167
fixed NA sibling_count3 0.008865 0.02092 0.4238 1859 0.6717 -0.03213 0.04986
fixed NA sibling_count4 0.03489 0.02196 1.589 1859 0.1123 -0.008154 0.07793
fixed NA sibling_count5 0.02659 0.02399 1.108 1859 0.2679 -0.02043 0.0736
fixed NA sibling_count>5 0.03027 0.02075 1.459 1859 0.1449 -0.01041 0.07094
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2791 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.08354 0.2386 -0.3502 1856 0.7262 -0.5511 0.384
fixed NA birth_order -0.001376 0.003918 -0.3513 1710 0.7254 -0.009056 0.006303
fixed NA poly(age, 3, raw = TRUE)1 0.08351 0.02527 3.305 1850 0.0009685 0.03398 0.133
fixed NA poly(age, 3, raw = TRUE)2 -0.00285 0.0008681 -3.283 1845 0.001046 -0.004551 -0.001149
fixed NA poly(age, 3, raw = TRUE)3 0.00002997 0.000009508 3.152 1840 0.001648 0.00001133 0.00004861
fixed NA male 0.2352 0.04153 5.664 1826 0.0000000171 0.1538 0.3166
fixed NA sibling_count3 0.009502 0.021 0.4525 1653 0.651 -0.03166 0.05066
fixed NA sibling_count4 0.03644 0.0224 1.626 1575 0.1041 -0.007474 0.08035
fixed NA sibling_count5 0.02904 0.02499 1.162 1462 0.2454 -0.01993 0.07801
fixed NA sibling_count>5 0.03525 0.02514 1.402 1446 0.161 -0.01402 0.08452
ran_pars mother_pidlink sd__(Intercept) 0.003056 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2792 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.08294 0.2389 -0.3471 1854 0.7285 -0.5513 0.3854
fixed NA poly(age, 3, raw = TRUE)1 0.08364 0.02531 3.305 1854 0.0009681 0.03404 0.1332
fixed NA poly(age, 3, raw = TRUE)2 -0.002862 0.0008694 -3.292 1854 0.001013 -0.004566 -0.001158
fixed NA poly(age, 3, raw = TRUE)3 0.00003026 0.000009525 3.177 1854 0.001513 0.00001159 0.00004893
fixed NA male 0.2362 0.04156 5.683 1854 0.00000001533 0.1547 0.3176
fixed NA sibling_count3 0.01247 0.02145 0.5814 1854 0.561 -0.02958 0.05452
fixed NA sibling_count4 0.04025 0.02337 1.722 1854 0.08522 -0.00556 0.08606
fixed NA sibling_count5 0.0282 0.02649 1.064 1854 0.2872 -0.02372 0.08012
fixed NA sibling_count>5 0.02489 0.02601 0.9569 1854 0.3387 -0.02609 0.07587
fixed NA birth_order_nonlinear2 -0.009683 0.01749 -0.5536 1854 0.5799 -0.04396 0.0246
fixed NA birth_order_nonlinear3 -0.01878 0.02057 -0.9128 1854 0.3615 -0.05909 0.02154
fixed NA birth_order_nonlinear4 -0.01068 0.02504 -0.4265 1854 0.6698 -0.05976 0.0384
fixed NA birth_order_nonlinear5 0.01235 0.03151 0.3919 1854 0.6951 -0.0494 0.0741
fixed NA birth_order_nonlinear>5 0.01187 0.02963 0.4004 1854 0.6889 -0.04622 0.06995
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2793 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.098 0.2399 -0.4085 1844 0.683 -0.5682 0.3722
fixed NA poly(age, 3, raw = TRUE)1 0.08341 0.02541 3.282 1844 0.00105 0.0336 0.1332
fixed NA poly(age, 3, raw = TRUE)2 -0.002855 0.0008731 -3.27 1844 0.001097 -0.004566 -0.001144
fixed NA poly(age, 3, raw = TRUE)3 0.00003018 0.000009567 3.155 1844 0.001632 0.00001143 0.00004894
fixed NA male 0.2385 0.04161 5.731 1844 0.00000001166 0.1569 0.32
fixed NA count_birth_order2/2 0.02927 0.03273 0.8945 1844 0.3712 -0.03487 0.09341
fixed NA count_birth_order1/3 0.01775 0.02863 0.6201 1844 0.5353 -0.03836 0.07387
fixed NA count_birth_order2/3 0.0114 0.03194 0.3568 1844 0.7213 -0.05121 0.074
fixed NA count_birth_order3/3 0.03532 0.03424 1.031 1844 0.3025 -0.0318 0.1024
fixed NA count_birth_order1/4 0.09363 0.03488 2.684 1844 0.007332 0.02527 0.162
fixed NA count_birth_order2/4 0.0124 0.03513 0.3529 1844 0.7242 -0.05646 0.08126
fixed NA count_birth_order3/4 0.029 0.03633 0.7981 1844 0.4249 -0.04221 0.1002
fixed NA count_birth_order4/4 0.04567 0.03891 1.174 1844 0.2407 -0.0306 0.1219
fixed NA count_birth_order1/5 0.06573 0.04413 1.49 1844 0.1365 -0.02075 0.1522
fixed NA count_birth_order2/5 0.0229 0.04788 0.4783 1844 0.6325 -0.07094 0.1167
fixed NA count_birth_order3/5 0.005765 0.04394 0.1312 1844 0.8956 -0.08035 0.09188
fixed NA count_birth_order4/5 0.06116 0.04205 1.454 1844 0.146 -0.02127 0.1436
fixed NA count_birth_order5/5 0.02552 0.04559 0.5598 1844 0.5757 -0.06383 0.1149
fixed NA count_birth_order1/>5 0.03691 0.03967 0.9304 1844 0.3523 -0.04085 0.1147
fixed NA count_birth_order2/>5 0.05884 0.04275 1.376 1844 0.1688 -0.02494 0.1426
fixed NA count_birth_order3/>5 0.004336 0.0406 0.1068 1844 0.915 -0.07523 0.0839
fixed NA count_birth_order4/>5 0.005484 0.03915 0.1401 1844 0.8886 -0.07126 0.08223
fixed NA count_birth_order5/>5 0.07248 0.03947 1.836 1844 0.06648 -0.004882 0.1498
fixed NA count_birth_order>5/>5 0.05185 0.02905 1.785 1844 0.07444 -0.005084 0.1088
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2794 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_alive_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 546.4 607.3 -262.2 524.4 NA NA NA
12 548.3 614.7 -262.2 524.3 0.124 1 0.7248
16 554.5 643.1 -261.3 522.5 1.784 4 0.7754
26 564.9 708.8 -256.5 512.9 9.584 10 0.4777

Maternal pregnancy order

outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>% 
  mutate(sibling_count = sibling_count_uterus_preg_factor,
         birth_order_nonlinear = birthorder_uterus_preg_factor,
         birth_order = birthorder_uterus_preg,
         count_birth_order = count_birthorder_uterus_preg
         ) %>% 
    filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_preg_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.06947 0.2387 -0.291 1876 0.7711 -0.5374 0.3984
fixed NA poly(age, 3, raw = TRUE)1 0.08058 0.02532 3.182 1876 0.001487 0.03094 0.1302
fixed NA poly(age, 3, raw = TRUE)2 -0.002747 0.0008703 -3.156 1876 0.001624 -0.004453 -0.001041
fixed NA poly(age, 3, raw = TRUE)3 0.00002892 0.000009536 3.032 1876 0.002461 0.00001023 0.00004761
fixed NA male 0.2456 0.04089 6.007 1876 0.000000002266 0.1655 0.3258
fixed NA sibling_count3 0.02061 0.02307 0.8931 1876 0.3719 -0.02461 0.06582
fixed NA sibling_count4 0.01468 0.02371 0.619 1876 0.536 -0.03179 0.06114
fixed NA sibling_count5 0.001525 0.02502 0.06093 1876 0.9514 -0.04751 0.05056
fixed NA sibling_count>5 0.03133 0.02169 1.444 1876 0.1489 -0.01119 0.07385
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2809 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.06945 0.2388 -0.2908 1875 0.7712 -0.5375 0.3986
fixed NA birth_order 0.0005249 0.003441 0.1525 1875 0.8788 -0.00622 0.007269
fixed NA poly(age, 3, raw = TRUE)1 0.0805 0.02533 3.177 1875 0.00151 0.03085 0.1302
fixed NA poly(age, 3, raw = TRUE)2 -0.002745 0.0008706 -3.153 1875 0.001639 -0.004452 -0.001039
fixed NA poly(age, 3, raw = TRUE)3 0.00002892 0.000009539 3.032 1875 0.002463 0.00001023 0.00004762
fixed NA male 0.2457 0.0409 6.006 1875 0.000000002277 0.1655 0.3258
fixed NA sibling_count3 0.02035 0.02314 0.8797 1875 0.3791 -0.02499 0.0657
fixed NA sibling_count4 0.01415 0.02397 0.5904 1875 0.555 -0.03282 0.06112
fixed NA sibling_count5 0.0006978 0.02561 0.02725 1875 0.9783 -0.04949 0.05089
fixed NA sibling_count>5 0.02945 0.02495 1.18 1875 0.2381 -0.01946 0.07836
ran_pars mother_pidlink sd__(Intercept) 0.000000004243 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.281 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.06587 0.2393 -0.2753 1871 0.7831 -0.5349 0.4031
fixed NA poly(age, 3, raw = TRUE)1 0.08039 0.02539 3.166 1871 0.001568 0.03063 0.1301
fixed NA poly(age, 3, raw = TRUE)2 -0.002747 0.0008723 -3.149 1871 0.001666 -0.004457 -0.001037
fixed NA poly(age, 3, raw = TRUE)3 0.00002904 0.000009559 3.038 1871 0.002412 0.00001031 0.00004778
fixed NA male 0.2466 0.04095 6.022 1871 0.000000002072 0.1663 0.3269
fixed NA sibling_count3 0.02183 0.02363 0.9241 1871 0.3555 -0.02447 0.06814
fixed NA sibling_count4 0.01509 0.02475 0.6096 1871 0.5422 -0.03342 0.06359
fixed NA sibling_count5 0.000362 0.02684 0.01349 1871 0.9892 -0.05225 0.05297
fixed NA sibling_count>5 0.0223 0.02591 0.8605 1871 0.3896 -0.02848 0.07307
fixed NA birth_order_nonlinear2 -0.005389 0.01784 -0.3021 1871 0.7626 -0.04035 0.02957
fixed NA birth_order_nonlinear3 -0.007488 0.0207 -0.3618 1871 0.7175 -0.04805 0.03308
fixed NA birth_order_nonlinear4 0.001033 0.02432 0.04248 1871 0.9661 -0.04663 0.0487
fixed NA birth_order_nonlinear5 0.00444 0.03014 0.1473 1871 0.8829 -0.05463 0.06351
fixed NA birth_order_nonlinear>5 0.0206 0.02719 0.7578 1871 0.4487 -0.03269 0.0739
ran_pars mother_pidlink sd__(Intercept) 0.00000008561 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2812 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.0715 0.2401 -0.2978 1861 0.7659 -0.5421 0.3991
fixed NA poly(age, 3, raw = TRUE)1 0.08093 0.02546 3.179 1861 0.001502 0.03104 0.1308
fixed NA poly(age, 3, raw = TRUE)2 -0.002754 0.0008747 -3.148 1861 0.00167 -0.004468 -0.001039
fixed NA poly(age, 3, raw = TRUE)3 0.000029 0.000009585 3.026 1861 0.002514 0.00001022 0.00004779
fixed NA male 0.2473 0.04103 6.026 1861 0.000000002019 0.1669 0.3277
fixed NA count_birth_order2/2 -0.01316 0.03653 -0.3603 1861 0.7187 -0.08475 0.05843
fixed NA count_birth_order1/3 0.00648 0.03199 0.2026 1861 0.8395 -0.05622 0.06918
fixed NA count_birth_order2/3 0.02276 0.03503 0.6497 1861 0.516 -0.0459 0.09142
fixed NA count_birth_order3/3 0.02057 0.03696 0.5564 1861 0.578 -0.05188 0.09301
fixed NA count_birth_order1/4 0.004074 0.03622 0.1125 1861 0.9105 -0.06692 0.07506
fixed NA count_birth_order2/4 -0.0125 0.0367 -0.3405 1861 0.7335 -0.08443 0.05943
fixed NA count_birth_order3/4 0.01958 0.0411 0.4763 1861 0.6339 -0.06098 0.1001
fixed NA count_birth_order4/4 0.03758 0.04186 0.8979 1861 0.3694 -0.04446 0.1196
fixed NA count_birth_order1/5 0.03448 0.0407 0.8472 1861 0.397 -0.04529 0.1143
fixed NA count_birth_order2/5 -0.06708 0.04668 -1.437 1861 0.1509 -0.1586 0.02441
fixed NA count_birth_order3/5 -0.01311 0.0456 -0.2876 1861 0.7737 -0.1025 0.07626
fixed NA count_birth_order4/5 0.01589 0.04613 0.3446 1861 0.7305 -0.07451 0.1063
fixed NA count_birth_order5/5 -0.01125 0.04681 -0.2404 1861 0.8101 -0.103 0.08049
fixed NA count_birth_order1/>5 0.01485 0.03818 0.3891 1861 0.6973 -0.05998 0.08969
fixed NA count_birth_order2/>5 0.0675 0.04056 1.664 1861 0.09626 -0.012 0.147
fixed NA count_birth_order3/>5 -0.009537 0.03866 -0.2467 1861 0.8052 -0.08532 0.06624
fixed NA count_birth_order4/>5 -0.005476 0.03705 -0.1478 1861 0.8825 -0.07809 0.06714
fixed NA count_birth_order5/>5 0.03103 0.03971 0.7813 1861 0.4347 -0.0468 0.1089
fixed NA count_birth_order>5/>5 0.03933 0.03021 1.302 1861 0.1931 -0.01988 0.09853
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2812 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_uterus_preg_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 575.8 636.8 -276.9 553.8 NA NA NA
12 577.8 644.3 -276.9 553.8 0.02339 1 0.8784
16 584.7 673.3 -276.3 552.7 1.123 4 0.8905
26 594.9 739 -271.4 542.9 9.793 10 0.4588

Parental full sibling order

outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
  mutate(sibling_count = sibling_count_genes_factor,
         birth_order_nonlinear = birthorder_genes_factor,
         birth_order = birthorder_genes,
         count_birth_order = count_birthorder_genes
         ) %>% 
      filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_parental_m1)
Basic Model
Model Summary
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.04607 0.2413 -0.1909 1820 0.8486 -0.519 0.4269
fixed NA poly(age, 3, raw = TRUE)1 0.0834 0.02552 3.267 1820 0.001105 0.03337 0.1334
fixed NA poly(age, 3, raw = TRUE)2 -0.002838 0.0008763 -3.239 1820 0.001221 -0.004556 -0.001121
fixed NA poly(age, 3, raw = TRUE)3 0.00002979 0.00000959 3.107 1820 0.001922 0.000011 0.00004859
fixed NA male 0.2043 0.04246 4.81 1820 0.00000163 0.121 0.2875
fixed NA sibling_count3 0.002244 0.02053 0.1094 1820 0.9129 -0.03798 0.04247
fixed NA sibling_count4 0.01715 0.02185 0.7848 1820 0.4327 -0.02568 0.05997
fixed NA sibling_count5 0.01547 0.02478 0.6244 1820 0.5325 -0.0331 0.06405
fixed NA sibling_count>5 0.01676 0.02088 0.8027 1820 0.4223 -0.02417 0.05769
ran_pars mother_pidlink sd__(Intercept) 0.000000003371 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2794 NA NA NA NA NA NA
Coefficient Plot
plot(allEffects(m1_covariates_only))

Add Birth Order Linear
Model Summary
tidy(m2_birthorder_linear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.04579 0.2414 -0.1897 1819 0.8495 -0.5188 0.4272
fixed NA birth_order -0.001402 0.004028 -0.3481 1819 0.7278 -0.009298 0.006493
fixed NA poly(age, 3, raw = TRUE)1 0.08359 0.02554 3.273 1819 0.001083 0.03354 0.1336
fixed NA poly(age, 3, raw = TRUE)2 -0.002842 0.0008765 -3.242 1819 0.001209 -0.00456 -0.001124
fixed NA poly(age, 3, raw = TRUE)3 0.00002977 0.000009593 3.103 1819 0.001942 0.00001097 0.00004857
fixed NA male 0.2039 0.04248 4.799 1819 0.000001729 0.1206 0.2871
fixed NA sibling_count3 0.002897 0.02062 0.1405 1819 0.8882 -0.03751 0.0433
fixed NA sibling_count4 0.01871 0.02231 0.8385 1819 0.4018 -0.02502 0.06243
fixed NA sibling_count5 0.01788 0.02573 0.6947 1819 0.4873 -0.03256 0.06831
fixed NA sibling_count>5 0.0218 0.02541 0.8578 1819 0.3911 -0.02801 0.07161
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2795 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder2(m2_birthorder_linear, separate = FALSE)

Add Birth Order Factor
Model Summary
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.04889 0.2419 -0.2021 1815 0.8398 -0.523 0.4252
fixed NA poly(age, 3, raw = TRUE)1 0.08412 0.0256 3.286 1815 0.001035 0.03395 0.1343
fixed NA poly(age, 3, raw = TRUE)2 -0.002866 0.0008787 -3.262 1815 0.001129 -0.004588 -0.001144
fixed NA poly(age, 3, raw = TRUE)3 0.00003016 0.000009617 3.136 1815 0.00174 0.00001131 0.00004901
fixed NA male 0.2047 0.04253 4.812 1815 0.000001614 0.1213 0.288
fixed NA sibling_count3 0.004311 0.0211 0.2044 1815 0.8381 -0.03704 0.04566
fixed NA sibling_count4 0.01953 0.02331 0.8379 1815 0.4022 -0.02615 0.06521
fixed NA sibling_count5 0.01357 0.02714 0.5 1815 0.6172 -0.03962 0.06676
fixed NA sibling_count>5 0.01085 0.02636 0.4114 1815 0.6808 -0.04083 0.06252
fixed NA birth_order_nonlinear2 -0.01028 0.01744 -0.5894 1815 0.5557 -0.04446 0.0239
fixed NA birth_order_nonlinear3 -0.01277 0.02068 -0.6177 1815 0.5369 -0.0533 0.02776
fixed NA birth_order_nonlinear4 -0.003305 0.02593 -0.1275 1815 0.8986 -0.05412 0.04751
fixed NA birth_order_nonlinear5 0.01257 0.03247 0.3873 1815 0.6986 -0.05106 0.0762
fixed NA birth_order_nonlinear>5 0.008002 0.03061 0.2614 1815 0.7938 -0.052 0.068
ran_pars mother_pidlink sd__(Intercept) 0 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2797 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)

Add Interaction
Model Summary
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T)
effect group term estimate std.error statistic df p.value conf.low conf.high
fixed NA (Intercept) -0.0656 0.2431 -0.2698 1805 0.7873 -0.5421 0.4109
fixed NA poly(age, 3, raw = TRUE)1 0.08471 0.02575 3.29 1805 0.001021 0.03425 0.1352
fixed NA poly(age, 3, raw = TRUE)2 -0.002891 0.000884 -3.27 1805 0.001096 -0.004623 -0.001158
fixed NA poly(age, 3, raw = TRUE)3 0.00003046 0.000009677 3.148 1805 0.00167 0.0000115 0.00004943
fixed NA male 0.2065 0.04261 4.845 1805 0.000001375 0.1229 0.29
fixed NA count_birth_order2/2 0.01718 0.03204 0.5362 1805 0.5919 -0.04562 0.07998
fixed NA count_birth_order1/3 0.005085 0.02819 0.1804 1805 0.8569 -0.05016 0.06033
fixed NA count_birth_order2/3 0.0003569 0.03145 0.01135 1805 0.9909 -0.06129 0.062
fixed NA count_birth_order3/3 0.02669 0.03354 0.7957 1805 0.4263 -0.03905 0.09243
fixed NA count_birth_order1/4 0.06555 0.0353 1.857 1805 0.06346 -0.003631 0.1347
fixed NA count_birth_order2/4 -0.01125 0.03483 -0.323 1805 0.7467 -0.07952 0.05702
fixed NA count_birth_order3/4 0.01287 0.03668 0.3507 1805 0.7259 -0.05903 0.08476
fixed NA count_birth_order4/4 0.02968 0.03883 0.7645 1805 0.4447 -0.04641 0.1058
fixed NA count_birth_order1/5 0.04971 0.0441 1.127 1805 0.2598 -0.03673 0.1361
fixed NA count_birth_order2/5 0.02667 0.04994 0.534 1805 0.5934 -0.07122 0.1246
fixed NA count_birth_order3/5 -0.01025 0.04789 -0.2141 1805 0.8305 -0.1041 0.08361
fixed NA count_birth_order4/5 0.0333 0.04609 0.7225 1805 0.4701 -0.05703 0.1236
fixed NA count_birth_order5/5 0.004253 0.04725 0.09001 1805 0.9283 -0.08835 0.09685
fixed NA count_birth_order1/>5 0.01471 0.04019 0.3659 1805 0.7145 -0.06407 0.09348
fixed NA count_birth_order2/>5 0.03404 0.04497 0.757 1805 0.4491 -0.0541 0.1222
fixed NA count_birth_order3/>5 -0.01059 0.0404 -0.262 1805 0.7933 -0.08976 0.06859
fixed NA count_birth_order4/>5 0.007186 0.04081 0.1761 1805 0.8603 -0.07281 0.08718
fixed NA count_birth_order5/>5 0.05585 0.04037 1.384 1805 0.1666 -0.02326 0.135
fixed NA count_birth_order>5/>5 0.0298 0.02955 1.009 1805 0.3133 -0.02811 0.08771
ran_pars mother_pidlink sd__(Intercept) 0.000000002737 NA NA NA NA NA NA
ran_pars Residual sd__Observation 0.2799 NA NA NA NA NA NA
Coefficient Plot
plot_birthorder(m4_interaction)

Model Comparison
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Data: birthorder %>% mutate(sibling_count = sibling_count_genes_factor, …
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
11 539.4 600.1 -258.7 517.4 NA NA NA
12 541.3 607.5 -258.7 517.3 0.1219 1 0.727
16 548.3 636.5 -258.2 516.3 0.9801 4 0.9128
26 561 704.3 -254.5 509 7.335 10 0.6935

Compare birth order specifications

library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
          intercept = FALSE)

Multiplot Linear Birth Order Effect

Models

Intelligence = lmer(g_factor_2015_old ~ birthorder_genes + poly(age, 3, raw = TRUE) + male +
                        sibling_count_genes +
               (1 | mother_pidlink),
                   data = birthorder)
`Educational Attainment` = lmer(years_of_education_z ~ birthorder_genes + poly(age, 3, raw = TRUE) + male +
                                  sibling_count_genes + (1 | mother_pidlink),
                   data = birthorder)
Extraversion = lmer(big5_ext ~ birthorder_genes + poly(age, 3, raw = TRUE) + male +
                                  sibling_count_genes + (1 | mother_pidlink),
                   data = birthorder)
Neuroticism = lmer(big5_neu ~ birthorder_genes + poly(age, 3, raw = TRUE) + male +
                                  sibling_count_genes + (1 | mother_pidlink),
                   data = birthorder)
Conscientiousness = lmer(big5_con ~ birthorder_genes + poly(age, 3, raw = TRUE) + male +
                                  sibling_count_genes + (1 | mother_pidlink),
                   data = birthorder)
Agreeableness = lmer(big5_agree ~ birthorder_genes + poly(age, 3, raw = TRUE) + male +
                                  sibling_count_genes + (1 | mother_pidlink),
                   data = birthorder)
Openness = lmer(big5_open ~ birthorder_genes + poly(age, 3, raw = TRUE) + male +
                                  sibling_count_genes + (1 | mother_pidlink),
                   data = birthorder)
RiskA = lmer(riskA ~ birthorder_genes + poly(age, 3, raw = TRUE) + male +
                                  sibling_count_genes + (1 | mother_pidlink),
                   data = birthorder)
RiskB = lmer(riskB ~ birthorder_genes + poly(age, 3, raw = TRUE) + male +
                                  sibling_count_genes + (1 | mother_pidlink),
                   data = birthorder)

Plot

x = multiplot(Intelligence, `Educational Attainment`, Agreeableness, Conscientiousness,
              Extraversion, Neuroticism, Openness, RiskA, RiskB,
              intercept = FALSE,
              coefficients = c("birthorder_genes", "sibling_count_genes"),
              outerCI = 2.807,
              plot = F)
        
x = data.frame(x) %>%
  mutate(Model = ifelse(Model == "`Educational Attainment`", "Educational Attainment", Model),
         Model = ifelse(Model == "RiskA", "Risk Aversion A", Model),
         Model = ifelse(Model == "RiskB", "Risk Aversion B", Model),
         Model = as.factor(Model))


levels(x$Model)

Agreeableness, Conscientiousness, Educational Attainment, Extraversion, Intelligence, Neuroticism, Openness, Risk Aversion A and Risk Aversion B

x$Coefficient = ifelse(x$Coefficient == "birthorder_genes", "Birth order", "Sibship size")

ggplot(x, aes(Model, Value)) +
  geom_pointrange(data=x, mapping=aes(x=Model, y=Value, ymin=HighOuter, ymax=LowOuter, color = Coefficient),
                  position = position_dodge(width=0.3), size = 1) +
  scale_colour_brewer(palette = "Set2") +
  geom_hline(yintercept = 0, size = 1.5)  +
  geom_hline(yintercept = -.1, linetype = "dotted", size = 1.5) + 
  scale_x_discrete(limits=c("Risk Aversion B", "Risk Aversion A", "Openness", "Neuroticism",
                            "Extraversion", "Conscientiousness", "Agreeableness",
                            "Educational Attainment", "Intelligence")) +
  scale_y_continuous(limits = c(-0.1, 0.06), breaks = c(-0.1, -0.05, 0, 0.05)) +
  coord_flip() +
  theme(text = element_text(size=25), axis.text.x = element_text(size = 20),
        axis.text.y = element_text(size = 20)) +
  labs(y = "Linear effect size", x = "Outcome") +
  apatheme

LS0tCnRpdGxlOiAiNF9hbmFseXNlcyIKYXV0aG9yOiAiTGF1cmEgQm90emV0ICYgUnViZW4gQXJzbGFuIgpvdXRwdXQ6IGh0bWxfZG9jdW1lbnQKZWRpdG9yX29wdGlvbnM6IAogIGNodW5rX291dHB1dF90eXBlOiBjb25zb2xlCi0tLQojIDxzcGFuIHN0eWxlPSJjb2xvcjojRTVDNDk0Ij5CaXJ0aCBPcmRlciBFZmZlY3RzPC9zcGFuPiB7LnRhYnNldH0KCiMjIEhlbHBlcgpgYGB7ciBoZWxwZXJ9CnNvdXJjZSgiMF9oZWxwZXJzLlIiKQpgYGAKCiMjIExvYWQgZGF0YQpgYGB7ciBMb2FkIERhdGF9CmJpcnRob3JkZXIgPSByZWFkUkRTKCJkYXRhL2FsbGRhdGFfYmlydGhvcmRlci5yZHMiKQpgYGAKCiMjIERhdGEgcHJlcGFyYXRpb25zCmBgYHtyIGRhdGEgcHJlcGFyYXRpb25zfQojIEZvciBhbmFseXNlcyB3ZSB3YW50IHRvIGNsZWFuIHRoZSBkYXRhc2V0IGFuZCBnZXQgcmlkIG9mIGFsbCB1bmludGVyZXN0aW5nIGRhdGEKYmlydGhvcmRlciA9IGJpcnRob3JkZXIgJT4lCiAgZmlsdGVyKCFpcy5uYShwaWRsaW5rKSkgJT4lICMgbm8gaW5kaXZpZHVhbHMgd2hvIGFyZSBvbmx5IGtub3duIGZyb20gdGhlIHByZWduYW5jeSBmaWxlCiAgZmlsdGVyKGlzLm5hKGxpZmViaXJ0aHMpIHwgbGlmZWJpcnRocyA9PSAyKSAlPiUgIyByZW1vdmUgNyBhbmQgMiBpbmRpdmlkdWFscyB3aG8gYXJlIGtub3duIGFzIHN0aWxsYmlydGggb3IgbWlzY2FycmlhZ2UgYnV0IHN0aWxsIGhhdmUgUElECiAgc2VsZWN0KC1saWZlYmlydGhzKSAlPiUKICBmaWx0ZXIoIWlzLm5hKG1vdGhlcl9waWRsaW5rKSkgJT4lCiAgc2VsZWN0KC1mYXRoZXJfcGlkbGluaykgJT4lCiAgZmlsdGVyKGlzLm5hKGFueV9tdWx0aXBsZV9iaXJ0aCkgfCBhbnlfbXVsdGlwbGVfYmlydGggIT0gMSkgJT4lICMgcmVtb3ZlIGZhbWlsaWVzIHdpdGggdHdpbnMvdHJpcGxldHMvLi4KICBmaWx0ZXIoIWlzLm5hKGJpcnRob3JkZXJfbmFpdmUpKSAlPiUKICBzZWxlY3QoLXN0YXJ0c193aXRoKCJhZ2VfIiksIC13YXZlLCAtYW55X211bHRpcGxlX2JpcnRoLCAtbXVsdGlwbGVfYmlydGgpICU+JQogIG11dGF0ZShtb25leV9zcGVudF9zbW9raW5nX2xvZyA9IGlmX2Vsc2UoaXMubmEobW9uZXlfc3BlbnRfc21va2luZ19sb2cpICYgZXZlcl9zbW9rZWQgPT0gMCwgMCwgbW9uZXlfc3BlbnRfc21va2luZ19sb2cpLAogICAgICAgICBhbW91bnQgPSBpZl9lbHNlKGlzLm5hKGFtb3VudCkgJiBldmVyX3Ntb2tlZCA9PSAwLCAwLCBhbW91bnQpLAogICAgICAgICBhbW91bnRfc3RpbGxfc21va2VycyA9IGlmX2Vsc2UoaXMubmEoYW1vdW50X3N0aWxsX3Ntb2tlcnMpICYgIHN0aWxsX3Ntb2tpbmcgPT0gMCwgMCwgYW1vdW50X3N0aWxsX3Ntb2tlcnMpLAogICAgICAgICBiaXJ0aHllYXIgPSBsdWJyaWRhdGU6OnllYXIoYmlydGhkYXRlKSkKCiMgcmVjb2RlIEZhY3RvciBWYXJpYWJsZSBhcyBEdW1teSBWYXJpYWJsZQpiaXJ0aG9yZGVyID0gbGVmdF9qb2luKGJpcnRob3JkZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlydGhvcmRlciAlPiUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbHRlcighaXMubmEoQ2F0ZWdvcnkpKSAlPiUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG11dGF0ZSh2YXIgPSAxKSAlPiUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdChwaWRsaW5rLCBDYXRlZ29yeSwgdmFyKSAlPiUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwcmVhZChDYXRlZ29yeSwgdmFyLCBmaWxsID0gMCwgc2VwID0gIl8iKSwgYnkgPSAicGlkbGluayIpICU+JQogIHNlbGVjdCgtQ2F0ZWdvcnkpCgojIHJlY29kZSBGYWN0b3IgVmFyaWFibGUgYXMgRHVtbXkgVmFyaWFibGUKYmlydGhvcmRlciA9IGxlZnRfam9pbihiaXJ0aG9yZGVyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpcnRob3JkZXIgJT4lCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWx0ZXIoIWlzLm5hKFNlY3RvcikpICU+JQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbXV0YXRlKHZhciA9IDEpICU+JQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0KHBpZGxpbmssIFNlY3RvciwgdmFyKSAlPiUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwcmVhZChTZWN0b3IsIHZhciwgZmlsbCA9IDAsIHNlcCA9ICJfIiksIGJ5ID0gInBpZGxpbmsiKSAlPiUKICBzZWxlY3QoLVNlY3RvcikKCiMjIyBWYXJpYWJsZXMKYmlydGhvcmRlciA9IGJpcnRob3JkZXIgJT4lCiAgbXV0YXRlKAogICAgIyBjZW50ZXIgdmFyaWFibGVzIHRoYXQgYXJlIHVzZWQgZm9yIGFuYWx5c2lzCiAgZ19mYWN0b3JfMjAxNV9vbGQgPSBzY2FsZShnX2ZhY3Rvcl8yMDE1X29sZCksCiAgZ19mYWN0b3JfMjAxNV95b3VuZyA9IHNjYWxlKGdfZmFjdG9yXzIwMTVfeW91bmcpLAogIGdfZmFjdG9yXzIwMDdfb2xkID0gc2NhbGUoZ19mYWN0b3JfMjAwN19vbGQpLAogIGdfZmFjdG9yXzIwMDdfeW91bmcgPSBzY2FsZShnX2ZhY3Rvcl8yMDA3X3lvdW5nKSwKICByYXZlbl8yMDE1X29sZCA9IHNjYWxlKHJhdmVuXzIwMTVfb2xkKSwKICBtYXRoXzIwMTVfb2xkID0gc2NhbGUobWF0aF8yMDE1X29sZCksCiAgY291bnRfYmFja3dhcmRzID0gc2NhbGUoY291bnRfYmFja3dhcmRzKSwKICByYXZlbl8yMDE1X3lvdW5nID0gc2NhbGUocmF2ZW5fMjAxNV95b3VuZyksCiAgbWF0aF8yMDE1X3lvdW5nID0gc2NhbGUobWF0aF8yMDE1X3lvdW5nKSwKICB3b3Jkc19yZW1lbWJlcmVkX2F2ZyA9IHNjYWxlKHdvcmRzX3JlbWVtYmVyZWRfYXZnKSwKICB3b3Jkc19pbW1lZGlhdGUgPSBzY2FsZSh3b3Jkc19pbW1lZGlhdGUpLAogIHdvcmRzX2RlbGF5ZWQgPSBzY2FsZSh3b3Jkc19kZWxheWVkKSwKICBhZGFwdGl2ZV9udW1iZXJpbmcgPSBzY2FsZShhZGFwdGl2ZV9udW1iZXJpbmcpLAogIHJhdmVuXzIwMDdfb2xkID0gc2NhbGUocmF2ZW5fMjAwN19vbGQpLAogIG1hdGhfMjAwN19vbGQgPSBzY2FsZShtYXRoXzIwMDdfb2xkKSwKICByYXZlbl8yMDA3X3lvdW5nID0gc2NhbGUocmF2ZW5fMjAwN195b3VuZyksCiAgbWF0aF8yMDA3X3lvdW5nID0gc2NhbGUobWF0aF8yMDA3X3lvdW5nKSwKICByaXNrQSA9IHNjYWxlKHJpc2tBKSwKICByaXNrQiA9IHNjYWxlKHJpc2tCKSwKICB5ZWFyc19vZl9lZHVjYXRpb25feiA9IHNjYWxlKHllYXJzX29mX2VkdWNhdGlvbiksCiAgVG90YWxfc2NvcmVfaGlnaGVzdF96ID0gc2NhbGUoVG90YWxfc2NvcmVfaGlnaGVzdCksCiAgd2FnZV9sYXN0X21vbnRoX3ogPSBzY2FsZSh3YWdlX2xhc3RfbW9udGhfbG9nKSwKICB3YWdlX2xhc3RfeWVhcl96ID0gc2NhbGUod2FnZV9sYXN0X3llYXJfbG9nKSwKICBiaWc1X2V4dCA9IHNjYWxlKGJpZzVfZXh0KSwKICBiaWc1X2NvbiA9IHNjYWxlKGJpZzVfY29uKSwKICBiaWc1X2FncmVlID0gc2NhbGUoYmlnNV9hZ3JlZSksCiAgYmlnNV9vcGVuID0gc2NhbGUoYmlnNV9vcGVuKSwKICBiaWc1X25ldSA9IHNjYWxlKGJpZzVfbmV1KSwKICBhdHRlbmRlZF9zY2hvb2wgPSBhcy5pbnRlZ2VyKGF0dGVuZGVkX3NjaG9vbCksCiAgYXR0ZW5kZWRfc2Nob29sID0gaWZlbHNlKGF0dGVuZGVkX3NjaG9vbCA9PSAxLCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICBpZmVsc2UoYXR0ZW5kZWRfc2Nob29sID09IDIsIDEsIE5BKSkpCgoKIyMjIEJpcnRob3JkZXIgYW5kIFNpYmxpbmcgQ291bnQKYmlydGhvcmRlciA9IGJpcnRob3JkZXIgJT4lIAogIG11dGF0ZSgKIyBiaXJ0aG9yZGVyIGFzIGZhY3RvcnMgd2l0aCBsZXZlbHMgb2YgMSwgMiwgMywgNCwgNSwgPjUKICAgIGJpcnRob3JkZXJfbmFpdmVfZmFjdG9yID0gYXMuY2hhcmFjdGVyKGJpcnRob3JkZXJfbmFpdmUpLAogICAgYmlydGhvcmRlcl9uYWl2ZV9mYWN0b3IgPSBpZmVsc2UoYmlydGhvcmRlcl9uYWl2ZSA+IDUsICI+NSIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlydGhvcmRlcl9uYWl2ZV9mYWN0b3IpLAogICAgYmlydGhvcmRlcl9uYWl2ZV9mYWN0b3IgPSBmYWN0b3IoYmlydGhvcmRlcl9uYWl2ZV9mYWN0b3IsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldmVscyA9IGMoIjEiLCIyIiwiMyIsIjQiLCI1IiwiPjUiKSksCiAgICBzaWJsaW5nX2NvdW50X25haXZlX2ZhY3RvciA9IGFzLmNoYXJhY3RlcihzaWJsaW5nX2NvdW50X25haXZlKSwKICAgIHNpYmxpbmdfY291bnRfbmFpdmVfZmFjdG9yID0gaWZlbHNlKHNpYmxpbmdfY291bnRfbmFpdmUgPiA1LCAiPjUiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpYmxpbmdfY291bnRfbmFpdmVfZmFjdG9yKSwKICAgIHNpYmxpbmdfY291bnRfbmFpdmVfZmFjdG9yID0gZmFjdG9yKHNpYmxpbmdfY291bnRfbmFpdmVfZmFjdG9yLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXZlbHMgPSBjKCIyIiwiMyIsIjQiLCI1IiwiPjUiKSksCgogICAgYmlydGhvcmRlcl91dGVydXNfYWxpdmVfZmFjdG9yID0gYXMuY2hhcmFjdGVyKGJpcnRob3JkZXJfdXRlcnVzX2FsaXZlKSwKICAgIGJpcnRob3JkZXJfdXRlcnVzX2FsaXZlX2ZhY3RvciA9IGlmZWxzZShiaXJ0aG9yZGVyX3V0ZXJ1c19hbGl2ZSA+IDUsICI+NSIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlydGhvcmRlcl91dGVydXNfYWxpdmVfZmFjdG9yKSwKICAgIGJpcnRob3JkZXJfdXRlcnVzX2FsaXZlX2ZhY3RvciA9IGZhY3RvcihiaXJ0aG9yZGVyX3V0ZXJ1c19hbGl2ZV9mYWN0b3IsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldmVscyA9IGMoIjEiLCIyIiwiMyIsIjQiLCI1IiwiPjUiKSksCiAgICBzaWJsaW5nX2NvdW50X3V0ZXJ1c19hbGl2ZV9mYWN0b3IgPSBhcy5jaGFyYWN0ZXIoc2libGluZ19jb3VudF91dGVydXNfYWxpdmUpLAogICAgc2libGluZ19jb3VudF91dGVydXNfYWxpdmVfZmFjdG9yID0gaWZlbHNlKHNpYmxpbmdfY291bnRfdXRlcnVzX2FsaXZlID4gNSwgIj41IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaWJsaW5nX2NvdW50X3V0ZXJ1c19hbGl2ZV9mYWN0b3IpLAogICAgc2libGluZ19jb3VudF91dGVydXNfYWxpdmVfZmFjdG9yID0gZmFjdG9yKHNpYmxpbmdfY291bnRfdXRlcnVzX2FsaXZlX2ZhY3RvciwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV2ZWxzID0gYygiMiIsIjMiLCI0IiwiNSIsIj41IikpLAogICAgYmlydGhvcmRlcl91dGVydXNfcHJlZ19mYWN0b3IgPSBhcy5jaGFyYWN0ZXIoYmlydGhvcmRlcl91dGVydXNfcHJlZyksCiAgICBiaXJ0aG9yZGVyX3V0ZXJ1c19wcmVnX2ZhY3RvciA9IGlmZWxzZShiaXJ0aG9yZGVyX3V0ZXJ1c19wcmVnID4gNSwgIj41IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpcnRob3JkZXJfdXRlcnVzX3ByZWdfZmFjdG9yKSwKICAgIGJpcnRob3JkZXJfdXRlcnVzX3ByZWdfZmFjdG9yID0gZmFjdG9yKGJpcnRob3JkZXJfdXRlcnVzX3ByZWdfZmFjdG9yLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV2ZWxzID0gYygiMSIsIjIiLCIzIiwiNCIsIjUiLCI+NSIpKSwKICAgIHNpYmxpbmdfY291bnRfdXRlcnVzX3ByZWdfZmFjdG9yID0gYXMuY2hhcmFjdGVyKHNpYmxpbmdfY291bnRfdXRlcnVzX3ByZWcpLAogICAgc2libGluZ19jb3VudF91dGVydXNfcHJlZ19mYWN0b3IgPSBpZmVsc2Uoc2libGluZ19jb3VudF91dGVydXNfcHJlZyA+IDUsICI+NSIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaWJsaW5nX2NvdW50X3V0ZXJ1c19wcmVnX2ZhY3RvciksCiAgICBzaWJsaW5nX2NvdW50X3V0ZXJ1c19wcmVnX2ZhY3RvciA9IGZhY3RvcihzaWJsaW5nX2NvdW50X3V0ZXJ1c19wcmVnX2ZhY3RvciwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXZlbHMgPSBjKCIyIiwiMyIsIjQiLCI1IiwiPjUiKSksCiAgICBiaXJ0aG9yZGVyX2dlbmVzX2ZhY3RvciA9IGFzLmNoYXJhY3RlcihiaXJ0aG9yZGVyX2dlbmVzKSwKICAgIGJpcnRob3JkZXJfZ2VuZXNfZmFjdG9yID0gaWZlbHNlKGJpcnRob3JkZXJfZ2VuZXMgPjUgLCAiPjUiLCBiaXJ0aG9yZGVyX2dlbmVzX2ZhY3RvciksCiAgICBiaXJ0aG9yZGVyX2dlbmVzX2ZhY3RvciA9IGZhY3RvcihiaXJ0aG9yZGVyX2dlbmVzX2ZhY3RvciwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXZlbHMgPSBjKCIxIiwiMiIsIjMiLCI0IiwiNSIsIj41IikpLAogICAgc2libGluZ19jb3VudF9nZW5lc19mYWN0b3IgPSBhcy5jaGFyYWN0ZXIoc2libGluZ19jb3VudF9nZW5lcyksCiAgICBzaWJsaW5nX2NvdW50X2dlbmVzX2ZhY3RvciA9IGlmZWxzZShzaWJsaW5nX2NvdW50X2dlbmVzID41ICwgIj41IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpYmxpbmdfY291bnRfZ2VuZXNfZmFjdG9yKSwKICAgIHNpYmxpbmdfY291bnRfZ2VuZXNfZmFjdG9yID0gZmFjdG9yKHNpYmxpbmdfY291bnRfZ2VuZXNfZmFjdG9yLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldmVscyA9IGMoIjIiLCIzIiwiNCIsIjUiLCI+NSIpKSwKICAgICMgaW50ZXJhY3Rpb24gYmlydGhvcmRlciAqIHNpYmxpbmdjb3V0IGZvciBlYWNoIGJpcnRob3JkZXIKICAgIGNvdW50X2JpcnRob3JkZXJfbmFpdmUgPQogICAgICBmYWN0b3Ioc3RyX3JlcGxhY2UoYXMuY2hhcmFjdGVyKGludGVyYWN0aW9uKGJpcnRob3JkZXJfbmFpdmVfZmFjdG9yLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2libGluZ19jb3VudF9uYWl2ZV9mYWN0b3IpKSwKICAgICAgICAgICAgICAgICAgICAgICAgIlxcLiIsICIvIiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXZlbHMgPSAgIGMoIjEvMiIsIjIvMiIsICIxLzMiLCAgIjIvMyIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIjMvMyIsICIxLzQiLCAiMi80IiwgIjMvNCIsICI0LzQiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIxLzUiLCAiMi81IiwgIjMvNSIsICI0LzUiLCAiNS81IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiMS8+NSIsICIyLz41IiwgIjMvPjUiLCAiNC8+NSIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIjUvPjUiLCAiPjUvPjUiKSksCiAgICBjb3VudF9iaXJ0aG9yZGVyX3V0ZXJ1c19hbGl2ZSA9CiAgICAgIGZhY3RvcihzdHJfcmVwbGFjZShhcy5jaGFyYWN0ZXIoaW50ZXJhY3Rpb24oYmlydGhvcmRlcl91dGVydXNfYWxpdmVfZmFjdG9yLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2libGluZ19jb3VudF91dGVydXNfYWxpdmVfZmFjdG9yKSksCiAgICAgICAgICAgICAgICAgICAgICAgICJcXC4iLCAiLyIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV2ZWxzID0gICBjKCIxLzIiLCIyLzIiLCAiMS8zIiwgICIyLzMiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIzLzMiLCAiMS80IiwgIjIvNCIsICIzLzQiLCAiNC80IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiMS81IiwgIjIvNSIsICIzLzUiLCAiNC81IiwgIjUvNSIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIjEvPjUiLCAiMi8+NSIsICIzLz41IiwgIjQvPjUiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICI1Lz41IiwgIj41Lz41IikpLAogICAgY291bnRfYmlydGhvcmRlcl91dGVydXNfcHJlZyA9CiAgICAgIGZhY3RvcihzdHJfcmVwbGFjZShhcy5jaGFyYWN0ZXIoaW50ZXJhY3Rpb24oYmlydGhvcmRlcl91dGVydXNfcHJlZ19mYWN0b3IsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaWJsaW5nX2NvdW50X3V0ZXJ1c19wcmVnX2ZhY3RvcikpLCAKICAgICAgICAgICAgICAgICAgICAgICAgICJcXC4iLCAiLyIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV2ZWxzID0gICBjKCIxLzIiLCIyLzIiLCAiMS8zIiwgICIyLzMiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIzLzMiLCAiMS80IiwgIjIvNCIsICIzLzQiLCAiNC80IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiMS81IiwgIjIvNSIsICIzLzUiLCAiNC81IiwgIjUvNSIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIjEvPjUiLCAiMi8+NSIsICIzLz41IiwgIjQvPjUiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICI1Lz41IiwgIj41Lz41IikpLAogICAgY291bnRfYmlydGhvcmRlcl9nZW5lcyA9CiAgICAgIGZhY3RvcihzdHJfcmVwbGFjZShhcy5jaGFyYWN0ZXIoaW50ZXJhY3Rpb24oYmlydGhvcmRlcl9nZW5lc19mYWN0b3IsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaWJsaW5nX2NvdW50X2dlbmVzX2ZhY3RvcikpLCAiXFwuIiwgIi8iKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldmVscyA9ICAgYygiMS8yIiwiMi8yIiwgIjEvMyIsICAiMi8zIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiMy8zIiwgIjEvNCIsICIyLzQiLCAiMy80IiwgIjQvNCIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIjEvNSIsICIyLzUiLCAiMy81IiwgIjQvNSIsICI1LzUiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIxLz41IiwgIjIvPjUiLCAiMy8+NSIsICI0Lz41IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiNS8+NSIsICI+NS8+NSIpKSkKCmJpcnRob3JkZXIgPC0gYmlydGhvcmRlciAlPiUKICAgICAgICAgICAgICAgICAgICAgbXV0YXRlKHNpYmxpbmdfY291bnQgPSBzaWJsaW5nX2NvdW50X25haXZlX2ZhY3RvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpcnRoX29yZGVyX25vbmxpbmVhciA9IGJpcnRob3JkZXJfbmFpdmVfZmFjdG9yLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlydGhfb3JkZXIgPSBiaXJ0aG9yZGVyX25haXZlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY291bnRfYmlydGhfb3JkZXIgPSBjb3VudF9iaXJ0aG9yZGVyX25haXZlKQoKYGBgCgoKIyMgSW50ZWxsaWdlbmNlIHsuYWN0aXZlIC50YWJzZXR9CiMjIyBnLWZhY3RvciAyMDE1IG9sZCB7LnRhYnNldH0KCmBgYHtyIGctZmFjdG9yIDIwMTUgb2xkfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gZ19mYWN0b3JfMjAxNV9vbGQpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArCiAgICAgICAgICAgICAgICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCgoKY29tcGFyZV9iaXJ0aG9yZGVyX3NwZWNzKG1vZGVsKQpgYGAKCgoKCiMjIyBSYXZlbiAyMDE1IG9sZCB7LnRhYnNldH0KCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gcmF2ZW5fMjAxNV9vbGQpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgojIyMgTnVtZXJhY3kgMjAxNSBvbGQgey50YWJzZXR9CgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IG1hdGhfMjAxNV9vbGQpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgojIyMgUmF2ZW4gMjAxNSB5b3VuZyB7LnRhYnNldH0KCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gcmF2ZW5fMjAxNV95b3VuZykKbW9kZWwgPSBsbWVyKG91dGNvbWUgfiBiaXJ0aF9vcmRlciArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKyBzaWJsaW5nX2NvdW50ICsgKDEgfCBtb3RoZXJfcGlkbGluayksCiAgICAgICAgICAgICAgICAgICBkYXRhID0gYmlydGhvcmRlcikKY29tcGFyZV9iaXJ0aG9yZGVyX3NwZWNzKG1vZGVsKQpgYGAKCiMjIyBOdW1lcmFjeSAyMDE1IHlvdW5nIHsudGFic2V0fQoKYGBge3J9CmJpcnRob3JkZXIgPC0gYmlydGhvcmRlciAlPiUgbXV0YXRlKG91dGNvbWUgPSBtYXRoXzIwMTVfeW91bmcpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgojIyMgQ291bnRpbmcgYmFja3dhcmRzIHsudGFic2V0fQoKYGBge3J9CmJpcnRob3JkZXIgPC0gYmlydGhvcmRlciAlPiUgbXV0YXRlKG91dGNvbWUgPSBjb3VudF9iYWNrd2FyZHMpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgojIyMgSW1tZWRpYXRlIHdvcmQgcmVjYWxsIHsudGFic2V0fQoKYGBge3J9CmJpcnRob3JkZXIgPC0gYmlydGhvcmRlciAlPiUgbXV0YXRlKG91dGNvbWUgPSB3b3Jkc19pbW1lZGlhdGUpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgojIyMgRGVsYXllZCB3b3JkIHJlY2FsbCB7LnRhYnNldH0KYGBge3J9CmJpcnRob3JkZXIgPC0gYmlydGhvcmRlciAlPiUgbXV0YXRlKG91dGNvbWUgPSB3b3Jkc19kZWxheWVkKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKIyMjIEFkYXB0aXZlIE51bWJlcmluZyB7LnRhYnNldH0KCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gYWRhcHRpdmVfbnVtYmVyaW5nKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKIyMgUGVyc29uYWxpdHkgey50YWJzZXR9CgojIyMgRXh0cmF2ZXJzaW9uIHsudGFic2V0fQoKCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gYmlnNV9leHQpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgoKIyMjIE5ldXJvdGljaXNtIHsudGFic2V0fQoKCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gYmlnNV9uZXUpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgoKIyMjIENvbnNjaWVudGlvdXNuZXNzIHsudGFic2V0fQoKCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gYmlnNV9jb24pCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgoKIyMjIEFncmVlYWJsZW5lc3Mgey50YWJzZXR9CgoKYGBge3J9CmJpcnRob3JkZXIgPC0gYmlydGhvcmRlciAlPiUgbXV0YXRlKG91dGNvbWUgPSBiaWc1X2FncmVlKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKCiMjIyBPcGVubmVzcyB7LnRhYnNldH0KCgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IGJpZzVfb3BlbikKbW9kZWwgPSBsbWVyKG91dGNvbWUgfiBiaXJ0aF9vcmRlciArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKyBzaWJsaW5nX2NvdW50ICsgKDEgfCBtb3RoZXJfcGlkbGluayksCiAgICAgICAgICAgICAgICAgICBkYXRhID0gYmlydGhvcmRlcikKY29tcGFyZV9iaXJ0aG9yZGVyX3NwZWNzKG1vZGVsKQpgYGAKCgojIyBSaXNrIHByZWZlcmVuY2Ugey50YWJzZXR9CgojIyMgUmlzayBBIHsudGFic2V0fQoKCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gcmlza0EpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgoKIyMjIFJpc2sgQiB7LnRhYnNldH0KCgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IHJpc2tCKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKCiMjIEVkdWNhdGlvbmFsIEF0dGFpbm1lbnQgey50YWJzZXR9CiMjIyBZZWFycyBvZiBFZHVjYXRpb24gLSB6LXN0YW5kYXJkaXplZCB7LnRhYnNldH0KCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0geWVhcnNfb2ZfZWR1Y2F0aW9uX3opCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgojIyMgRWxlbWVudGFyeSBtaXNzZWQgey50YWJzZXR9CgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IEVsZW1lbnRhcnlfbWlzc2VkKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKCiMjIyBFbGVtZW50YXJ5IHdvcmtlZCB7LnRhYnNldH0KCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gRWxlbWVudGFyeV93b3JrZWQpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgoKIyMjIEF0dGVuZGVkIFNjaG9vbCB7LnRhYnNldH0KCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gYXR0ZW5kZWRfc2Nob29sKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKCiMjIFdvcmsgey50YWJzZXR9CgojIyMgSW5jb21lIExhc3QgTW9udGggKGxvZykgLSB6LXN0YW5kYXJkaXplZCB7LnRhYnNldH0KCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gd2FnZV9sYXN0X21vbnRoX3opCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgojIyMgSW5jb21lIGxhc3QgeWVhciAobG9nKSAtIHotc3RhbmRhcmRpemVkIHsudGFic2V0fQoKYGBge3J9CmJpcnRob3JkZXIgPC0gYmlydGhvcmRlciAlPiUgbXV0YXRlKG91dGNvbWUgPSB3YWdlX2xhc3RfeWVhcl96KQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKIyMjIFNlbGYtRW1wbG95bWVudCAtIG5vbiBzdGFuZGFyZGl6ZWQgey50YWJzZXR9CgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IFNlbGZfZW1wbG95ZWQpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgoKIyMgV29yayBDYXRlZ29yeXsudGFic2V0fQoKIyMjIENhdGVnb3J5X0Nhc3VhbCB3b3JrZXIgaW4gYWdyaWN1bHR1cmV7LnRhYnNldH0KCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gYENhdGVnb3J5X0Nhc3VhbCB3b3JrZXIgaW4gYWdyaWN1bHR1cmVgKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKIyMjIENhdGVnb3J5X0Nhc3VhbCB3b3JrZXIgbm90IGluIGFncmljdWx0dXJley50YWJzZXR9CgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IGBDYXRlZ29yeV9DYXN1YWwgd29ya2VyIG5vdCBpbiBhZ3JpY3VsdHVyZWApCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgojIyMgQ2F0ZWdvcnlfR292ZXJubWVudCB3b3JrZXJ7LnRhYnNldH0KCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gYENhdGVnb3J5X0dvdmVybm1lbnQgd29ya2VyYCkKbW9kZWwgPSBsbWVyKG91dGNvbWUgfiBiaXJ0aF9vcmRlciArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKyBzaWJsaW5nX2NvdW50ICsgKDEgfCBtb3RoZXJfcGlkbGluayksCiAgICAgICAgICAgICAgICAgICBkYXRhID0gYmlydGhvcmRlcikKY29tcGFyZV9iaXJ0aG9yZGVyX3NwZWNzKG1vZGVsKQpgYGAKCgojIyMgQ2F0ZWdvcnlfUHJpdmF0ZSB3b3JrZXJ7LnRhYnNldH0KCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gYENhdGVnb3J5X1ByaXZhdGUgd29ya2VyYCkKbW9kZWwgPSBsbWVyKG91dGNvbWUgfiBiaXJ0aF9vcmRlciArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKyBzaWJsaW5nX2NvdW50ICsgKDEgfCBtb3RoZXJfcGlkbGluayksCiAgICAgICAgICAgICAgICAgICBkYXRhID0gYmlydGhvcmRlcikKY29tcGFyZV9iaXJ0aG9yZGVyX3NwZWNzKG1vZGVsKQpgYGAKCiMjIyBDYXRlZ29yeV9TZWxmLWVtcGxveWVkey50YWJzZXR9CgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IGBDYXRlZ29yeV9TZWxmLWVtcGxveWVkYCkKbW9kZWwgPSBsbWVyKG91dGNvbWUgfiBiaXJ0aF9vcmRlciArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKyBzaWJsaW5nX2NvdW50ICsgKDEgfCBtb3RoZXJfcGlkbGluayksCiAgICAgICAgICAgICAgICAgICBkYXRhID0gYmlydGhvcmRlcikKY29tcGFyZV9iaXJ0aG9yZGVyX3NwZWNzKG1vZGVsKQpgYGAKCiMjIyBDYXRlZ29yeV9VbnBhaWQgZmFtaWx5IHdvcmtlcnsudGFic2V0fQoKYGBge3J9CmJpcnRob3JkZXIgPC0gYmlydGhvcmRlciAlPiUgbXV0YXRlKG91dGNvbWUgPSBgQ2F0ZWdvcnlfVW5wYWlkIGZhbWlseSB3b3JrZXJgKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKIyMgV29yayBTZWN0b3Igey50YWJzZXR9CgojIyMgU2VjdG9yX0FncmljdWx0dXJlLCBmb3Jlc3RyeSwgZmlzaGluZyBhbmQgaHVudGluZyB7LnRhYnNldH0KCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gYFNlY3Rvcl9BZ3JpY3VsdHVyZSwgZm9yZXN0cnksIGZpc2hpbmcgYW5kIGh1bnRpbmdgKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKIyMjIFNlY3Rvcl9Db25zdHJ1Y3Rpb24gey50YWJzZXR9CgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IGBTZWN0b3JfQ29uc3RydWN0aW9uYCkKbW9kZWwgPSBsbWVyKG91dGNvbWUgfiBiaXJ0aF9vcmRlciArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKyBzaWJsaW5nX2NvdW50ICsgKDEgfCBtb3RoZXJfcGlkbGluayksCiAgICAgICAgICAgICAgICAgICBkYXRhID0gYmlydGhvcmRlcikKY29tcGFyZV9iaXJ0aG9yZGVyX3NwZWNzKG1vZGVsKQpgYGAKCiMjIyBTZWN0b3JfRWxlY3RyaWNpdHksIGdhcywgd2F0ZXIgey50YWJzZXR9CgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IGBTZWN0b3JfRWxlY3RyaWNpdHksIGdhcywgd2F0ZXJgKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKCiMjIyBTZWN0b3JfRmluYW5jZSwgaW5zdXJhbmNlLCByZWFsIGVzdGF0ZSBhbmQgYnVzaW5lc3Mgc2VydmljZXMgey50YWJzZXR9CgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IGBTZWN0b3JfRmluYW5jZSwgaW5zdXJhbmNlLCByZWFsIGVzdGF0ZSBhbmQgYnVzaW5lc3Mgc2VydmljZXNgKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKCiMjIyBTZWN0b3JfTWFudWZhY3R1cmluZyB7LnRhYnNldH0KCmBgYHtyfQpiaXJ0aG9yZGVyIDwtIGJpcnRob3JkZXIgJT4lIG11dGF0ZShvdXRjb21lID0gU2VjdG9yX01hbnVmYWN0dXJpbmcpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgoKCiMjIyBTZWN0b3JfTWluaW5nIGFuZCBxdWFycnlpbmcgey50YWJzZXR9CgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IGBTZWN0b3JfTWluaW5nIGFuZCBxdWFycnlpbmdgKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKCiMjIyBTZWN0b3JfU29jaWFsIHNlcnZpY2VzIHsudGFic2V0fQoKYGBge3J9CmJpcnRob3JkZXIgPC0gYmlydGhvcmRlciAlPiUgbXV0YXRlKG91dGNvbWUgPSBgU2VjdG9yX1NvY2lhbCBzZXJ2aWNlc2ApCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgoKIyMjIFNlY3Rvcl9UcmFuc3BvcnRhdGlvbiwgc3RvcmFnZSBhbmQgY29tbXVuaWNhdGlvbnMgey50YWJzZXR9CgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IGBTZWN0b3JfVHJhbnNwb3J0YXRpb24sIHN0b3JhZ2UgYW5kIGNvbW11bmljYXRpb25zYCkKbW9kZWwgPSBsbWVyKG91dGNvbWUgfiBiaXJ0aF9vcmRlciArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKyBzaWJsaW5nX2NvdW50ICsgKDEgfCBtb3RoZXJfcGlkbGluayksCiAgICAgICAgICAgICAgICAgICBkYXRhID0gYmlydGhvcmRlcikKY29tcGFyZV9iaXJ0aG9yZGVyX3NwZWNzKG1vZGVsKQpgYGAKCiMjIFNtb2tpbmcgQmVoYXZpb3VyIHsudGFic2V0fQojIyMgZXZlcl9zbW9rZWQgey50YWJzZXR9CgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IGV2ZXJfc21va2VkKQptb2RlbCA9IGxtZXIob3V0Y29tZSB+IGJpcnRoX29yZGVyICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArIHNpYmxpbmdfY291bnQgKyAoMSB8IG1vdGhlcl9waWRsaW5rKSwKICAgICAgICAgICAgICAgICAgIGRhdGEgPSBiaXJ0aG9yZGVyKQpjb21wYXJlX2JpcnRob3JkZXJfc3BlY3MobW9kZWwpCmBgYAoKIyMjIHN0aWxsX3Ntb2tpbmcgey50YWJzZXR9CgpgYGB7cn0KYmlydGhvcmRlciA8LSBiaXJ0aG9yZGVyICU+JSBtdXRhdGUob3V0Y29tZSA9IHN0aWxsX3Ntb2tpbmcpCm1vZGVsID0gbG1lcihvdXRjb21lIH4gYmlydGhfb3JkZXIgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsgc2libGluZ19jb3VudCArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCmNvbXBhcmVfYmlydGhvcmRlcl9zcGVjcyhtb2RlbCkKYGBgCgojIyBNdWx0aXBsb3QgTGluZWFyIEJpcnRoIE9yZGVyIEVmZmVjdCB7LnRhYnNldH0KCiMjIyBNb2RlbHMgey50YWJzZXR9CgpgYGB7ciBnLWZhY3RvciAyMDE1IG9sZH0KSW50ZWxsaWdlbmNlID0gbG1lcihnX2ZhY3Rvcl8yMDE1X29sZCB+IGJpcnRob3JkZXJfZ2VuZXMgKyBwb2x5KGFnZSwgMywgcmF3ID0gVFJVRSkgKyBtYWxlICsKICAgICAgICAgICAgICAgICAgICAgICAgc2libGluZ19jb3VudF9nZW5lcyArCiAgICAgICAgICAgICAgICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCgpgYGAKCmBgYHtyIGctZmFjdG9yIDIwMTUgb2xkfQpgRWR1Y2F0aW9uYWwgQXR0YWlubWVudGAgPSBsbWVyKHllYXJzX29mX2VkdWNhdGlvbl96IH4gYmlydGhvcmRlcl9nZW5lcyArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2libGluZ19jb3VudF9nZW5lcyArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCgoKYGBgCgoKCmBgYHtyIGctZmFjdG9yIDIwMTUgb2xkfQpFeHRyYXZlcnNpb24gPSBsbWVyKGJpZzVfZXh0IH4gYmlydGhvcmRlcl9nZW5lcyArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2libGluZ19jb3VudF9nZW5lcyArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCgoKYGBgCgoKCmBgYHtyIGctZmFjdG9yIDIwMTUgb2xkfQpOZXVyb3RpY2lzbSA9IGxtZXIoYmlnNV9uZXUgfiBiaXJ0aG9yZGVyX2dlbmVzICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaWJsaW5nX2NvdW50X2dlbmVzICsgKDEgfCBtb3RoZXJfcGlkbGluayksCiAgICAgICAgICAgICAgICAgICBkYXRhID0gYmlydGhvcmRlcikKCgpgYGAKCgpgYGB7ciBnLWZhY3RvciAyMDE1IG9sZH0KQ29uc2NpZW50aW91c25lc3MgPSBsbWVyKGJpZzVfY29uIH4gYmlydGhvcmRlcl9nZW5lcyArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2libGluZ19jb3VudF9nZW5lcyArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCgoKYGBgCgoKCmBgYHtyIGctZmFjdG9yIDIwMTUgb2xkfQpBZ3JlZWFibGVuZXNzID0gbG1lcihiaWc1X2FncmVlIH4gYmlydGhvcmRlcl9nZW5lcyArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2libGluZ19jb3VudF9nZW5lcyArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCgoKYGBgCgoKYGBge3IgZy1mYWN0b3IgMjAxNSBvbGR9Ck9wZW5uZXNzID0gbG1lcihiaWc1X29wZW4gfiBiaXJ0aG9yZGVyX2dlbmVzICsgcG9seShhZ2UsIDMsIHJhdyA9IFRSVUUpICsgbWFsZSArCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaWJsaW5nX2NvdW50X2dlbmVzICsgKDEgfCBtb3RoZXJfcGlkbGluayksCiAgICAgICAgICAgICAgICAgICBkYXRhID0gYmlydGhvcmRlcikKCgpgYGAKCgpgYGB7ciBnLWZhY3RvciAyMDE1IG9sZH0KUmlza0EgPSBsbWVyKHJpc2tBIH4gYmlydGhvcmRlcl9nZW5lcyArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2libGluZ19jb3VudF9nZW5lcyArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCgoKYGBgCgpgYGB7ciBnLWZhY3RvciAyMDE1IG9sZH0KUmlza0IgPSBsbWVyKHJpc2tCIH4gYmlydGhvcmRlcl9nZW5lcyArIHBvbHkoYWdlLCAzLCByYXcgPSBUUlVFKSArIG1hbGUgKwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2libGluZ19jb3VudF9nZW5lcyArICgxIHwgbW90aGVyX3BpZGxpbmspLAogICAgICAgICAgICAgICAgICAgZGF0YSA9IGJpcnRob3JkZXIpCgoKYGBgCgojIyMgUGxvdCB7LmFjdGl2ZX0KYGBge3J9CnggPSBtdWx0aXBsb3QoSW50ZWxsaWdlbmNlLCBgRWR1Y2F0aW9uYWwgQXR0YWlubWVudGAsIEFncmVlYWJsZW5lc3MsIENvbnNjaWVudGlvdXNuZXNzLAogICAgICAgICAgICAgIEV4dHJhdmVyc2lvbiwgTmV1cm90aWNpc20sIE9wZW5uZXNzLCBSaXNrQSwgUmlza0IsCiAgICAgICAgICAgICAgaW50ZXJjZXB0ID0gRkFMU0UsCiAgICAgICAgICAgICAgY29lZmZpY2llbnRzID0gYygiYmlydGhvcmRlcl9nZW5lcyIsICJzaWJsaW5nX2NvdW50X2dlbmVzIiksCiAgICAgICAgICAgICAgb3V0ZXJDSSA9IDIuODA3LAogICAgICAgICAgICAgIHBsb3QgPSBGKQogICAgICAgIAp4ID0gZGF0YS5mcmFtZSh4KSAlPiUKICBtdXRhdGUoTW9kZWwgPSBpZmVsc2UoTW9kZWwgPT0gImBFZHVjYXRpb25hbCBBdHRhaW5tZW50YCIsICJFZHVjYXRpb25hbCBBdHRhaW5tZW50IiwgTW9kZWwpLAogICAgICAgICBNb2RlbCA9IGlmZWxzZShNb2RlbCA9PSAiUmlza0EiLCAiUmlzayBBdmVyc2lvbiBBIiwgTW9kZWwpLAogICAgICAgICBNb2RlbCA9IGlmZWxzZShNb2RlbCA9PSAiUmlza0IiLCAiUmlzayBBdmVyc2lvbiBCIiwgTW9kZWwpLAogICAgICAgICBNb2RlbCA9IGFzLmZhY3RvcihNb2RlbCkpCgoKbGV2ZWxzKHgkTW9kZWwpCgp4JENvZWZmaWNpZW50ID0gaWZlbHNlKHgkQ29lZmZpY2llbnQgPT0gImJpcnRob3JkZXJfZ2VuZXMiLCAiQmlydGggb3JkZXIiLCAiU2lic2hpcCBzaXplIikKCmdncGxvdCh4LCBhZXMoTW9kZWwsIFZhbHVlKSkgKwogIGdlb21fcG9pbnRyYW5nZShkYXRhPXgsIG1hcHBpbmc9YWVzKHg9TW9kZWwsIHk9VmFsdWUsIHltaW49SGlnaE91dGVyLCB5bWF4PUxvd091dGVyLCBjb2xvciA9IENvZWZmaWNpZW50KSwKICAgICAgICAgICAgICAgICAgcG9zaXRpb24gPSBwb3NpdGlvbl9kb2RnZSh3aWR0aD0wLjMpLCBzaXplID0gMSkgKwogIHNjYWxlX2NvbG91cl9icmV3ZXIocGFsZXR0ZSA9ICJTZXQyIikgKwogIGdlb21faGxpbmUoeWludGVyY2VwdCA9IDAsIHNpemUgPSAxLjUpICArCiAgZ2VvbV9obGluZSh5aW50ZXJjZXB0ID0gLS4xLCBsaW5ldHlwZSA9ICJkb3R0ZWQiLCBzaXplID0gMS41KSArIAogIHNjYWxlX3hfZGlzY3JldGUobGltaXRzPWMoIlJpc2sgQXZlcnNpb24gQiIsICJSaXNrIEF2ZXJzaW9uIEEiLCAiT3Blbm5lc3MiLCAiTmV1cm90aWNpc20iLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIkV4dHJhdmVyc2lvbiIsICJDb25zY2llbnRpb3VzbmVzcyIsICJBZ3JlZWFibGVuZXNzIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFZHVjYXRpb25hbCBBdHRhaW5tZW50IiwgIkludGVsbGlnZW5jZSIpKSArCiAgc2NhbGVfeV9jb250aW51b3VzKGxpbWl0cyA9IGMoLTAuMSwgMC4wNiksIGJyZWFrcyA9IGMoLTAuMSwgLTAuMDUsIDAsIDAuMDUpKSArCiAgY29vcmRfZmxpcCgpICsKICB0aGVtZSh0ZXh0ID0gZWxlbWVudF90ZXh0KHNpemU9MjUpLCBheGlzLnRleHQueCA9IGVsZW1lbnRfdGV4dChzaXplID0gMjApLAogICAgICAgIGF4aXMudGV4dC55ID0gZWxlbWVudF90ZXh0KHNpemUgPSAyMCkpICsKICBsYWJzKHkgPSAiTGluZWFyIGVmZmVjdCBzaXplIiwgeCA9ICJPdXRjb21lIikgKwogIGFwYXRoZW1lCiAgCmBgYAo=